Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <table id="aid" class="roll lst">
<thead><tr><th>Cat&eacute;gorie</th><th>Conducteur</th><th>Blindage</th><th>LSZH</th><th class="lst">Offre <span>(prix au m&egrave;tre et TTC)</span></th></tr></thead>
<tbody>

<tr class="alsa"><td colspan ="4" id="a"><a href="#">Cat5e</a></td></tr>

<tr><td rowspan="6" class="cat rgt" id="A"><a href="#">Cat5e</a></td><td rowspan="3" class="rdo bdo" id="A1"><a href="#">Monobrin</a></td><td id="A11" class="rpp bpp"><a href="#">UTP</a></td><td class="rpp bpp tdf"></td><td id="A111" class="lst bpp"><a href="#">3 produits, 4 versions de 0,37 &agrave; 0,53&nbsp;&euro;</a></td></tr>
<tr><td id="A12" class="rpp bpp"><a href="#">F / UTP</a></td><td id="A121" class="rpp  cen bpp"><a href="#">(oui)</a></td><td id="A1211" class="lst bpp"><a href="#">3 produits, 6 versions de 0,55 &agrave; 1,21&nbsp;&euro;</a></td></tr>
<tr><td id="A13" class="rpp bdo"><a href="#">SF / UTP</a></td><td id="A131" class="rpp  cen bdo"><a href="#">(oui)</a></td><td id="A1311" class="lst bdo"><a href="#">2 produits, 3 versions de 0,85 &agrave; 0,91&nbsp;&euro;</a></td></tr>
<tr><td rowspan="3" class="rdo cat" id ="A2"><a href="#">Multibrin</a></td><td id="A21" class="rpp bpp"><a href="#">UTP</a></td><td class="rpp bpp tdf"></td><td id="A211" class="lst bpp"><a href="#">2 versions &agrave; 0,53&nbsp;&euro;</a></td></tr>
<tr><td id="A22" class="rpp bpp"><a href="#">F / UTP</a></td><td class="rpp bpp tdf"></td><td id="A221" class="lst bpp"><a href="#">2 versions de 0,26 &agrave; 0,52&nbsp;&euro;</a><em>-50&nbsp;%</em></td></tr>
<tr><td id="A23" class="rpp cat"><a href="#">SF / UTP</a></td><td class="rpp cat tdf"></td><td id="A231" class="lst cat"><a href="#">2 versions de 0,71 &agrave; 0,85&nbsp;&euro;</a></td></tr>

<tr class="alsa"><td colspan ="4" id="b"><a href="#">Cat6</a></td></tr>

<tr><td rowspan="7" class="cat rgt" id="B"><a href="#">Cat6</a></td><td rowspan="4" class="rdo bdo" id="B1"><a href="#">Monobrin</a></td><td id="B11" class="rpp bpp"><a href="#">UTP</a></td><td id="B111" class="rpp  cen bpp"><a href="#">(oui)</a></td><td id="B1111" class="lst bpp"><a href="#">4 produits, 5 versions de 0,50 &agrave; 0,67&nbsp;&euro;</a></td></tr>
<tr><td id="B12" class="rpp bpp"><a href="#">F / UTP</a></td><td id="B121" class="rpp  cen bpp"><a href="#">(oui)</a></td><td id="B1211" class="lst bpp"><a href="#">6 produits, 19 versions de 0,58 &agrave; 2,82&nbsp;&euro;</a></td></tr>
<tr><td id="B13" class="rpp bpp"><a href="#">U / FTP</a></td><td id="B131" class="rpp  cen bpp"><a href="#">(oui)</a></td><td id="B1311" class="lst bpp"><a href="#">2 produits, 8 versions de 0,60 &agrave; 2,40&nbsp;&euro;</a></td></tr>
<tr><td id="B14" class="rpp bdo"><a href="#">S / FTP</a></td><td id="B141" class="rpp  cen bdo"><a href="#">(oui)</a></td><td id="B1411" class="lst bdo"><a href="#">3 produits, 4 versions de 0,78 &agrave; 0,98&nbsp;&euro;</a></td></tr>
<tr><td rowspan="3" class="rdo cat" id ="B2"><a href="#">Multibrin</a></td><td id="B21" class="rpp bpp"><a href="#">UTP</a></td><td class="rpp bpp tdf"></td><td id="B211" class="lst bpp"><a href="#">0,60&nbsp;&euro;</a></td></tr>
<tr><td id="B22" class="rpp bpp"><a href="#">F / UTP</a></td><td class="rpp bpp tdf"></td><td id="B221" class="lst bpp"><a href="#">15 versions de 0,38 &agrave; 0,55&nbsp;&euro;</a></td></tr>
<tr><td id="B23" class="rpp cat"><a href="#">S / FTP</a></td><td class="rpp cat tdf"></td><td id="B231" class="lst cat"><a href="#">2 produits, 13 versions de 0,66 &agrave; 0,80&nbsp;&euro;</a></td></tr>
</tbody>
</table>
              
            
!

CSS

              
                table.roll tr.alsa {display: none}

td.blu a {color: red}

table.roll td {white-space: nowrap}

@media screen and (max-width: 768px)
{

table.roll thead th:first-child, table.roll thead td:first-child, table.roll th.lst span, table.roll tr.alsa + tr td:first-child {display: none}
table.roll tr.alsa {display: table-row}
table.roll thead th {text-align: center !important; font-size: 0.9em}
table#aid.roll tr.alsa td {text-align: center; font-size: 1.3em; padding: 0.5em 0; border-bottom: 1px solid #7A8B9A}
table#aid.roll td:nth-child(n+2) {white-space: normal}


table#aid tr.alsa td::before {content: "Cat\0000E9\gorie : "; font-size: 0.692307692em; color: #696969}
  
}
              
            
!

JS

              
                /*
window.addEvent = function (objet, evenement, fonction, capture)
{capture = capture || false;
if (objet.addEventListener) {objet.addEventListener(evenement, fonction, capture);}
else if (objet.attachEvent) {objet.attachEvent( 'on' + evenement, function () { return fonction.apply(objet, arguments);});}
else {if (!objet['on' + evenement]) {objet['on' + evenement] = fonction;}
else {var _fonction = objet['on' + evenement]; objet['on' + evenement] = function () { _fonction(); fonction();};}}}
window.addOnLoad = function (fonction)
{addEvent(window, 'load', fonction);}
function hasClass (el, cn)
{if (!el) return; return new RegExp("(^| )" + cn + "( |$)").test(el.className);}
function addClass (el, cn)
{if (!el) return;
if (!el.className) {el.className = cn;}
else if (!hasClass(el, cn))
{el.className += " " + cn;}}
function removeClass (el, cn)
{if (!el) return;
el.className = el.className.replace(new RegExp("(^| )" + cn + "( |$)"), "$1").replace(/ $/, "");}
function replaceClass (el, cn, newCn)
{el.className = el.className.replace(new RegExp("(^| )" + cn + "( |$)"), "$1" + newCn + "$2");}
function getElementsByClassName (className, theElement)
{var elts = theElement.getElementsByTagName('*');
var classArray = new Array();
for (var j = 0; j < elts.length; ++j)
{if (hasClass(elts[j], className)) {classArray.push(elts[j]);}}
return classArray;}
function addCustomRollover (table, callback)
{if (typeof (callback) != 'function') return;
var tds = table.getElementsByTagName('td');
for (var i_td = 0, l_td = tds.length; i_td < l_td; ++i_td)
{var td = tds[i_td]; var overFunc = function ( event )
{callback(this, true);
if (event.preventDefault) {event.preventDefault();} event.returnValue = false;};
var outFunc = function (event)
{callback(this, false); if (event.preventDefault) {event.preventDefault();}
event.returnValue = false;};
addEvent(td, 'mouseover', overFunc, false);
addEvent(td, 'mouseout', outFunc, false);}}


function initBotegaRollover() {
  // définition fonction
  const customFunction = function (objet, doOver) {
    let id = objet.id;
    while (id.length > 1) {
      id = id.substr(0, id.length - 1);
      // récup. lower et Upper id
      elems = document.querySelectorAll("#" + id + ",#" + id.toLowerCase());
      // Array.prototype.forEach.call(elems, function(el){  // si IE support
      elems.forEach(function (el) {
        doOver ? addClass(el, 'blu') : removeClass(el, 'blu');
      });
    }
  };
  // affectation action aux tables
  const tables = document.querySelectorAll(".roll");
  // Array.prototype.forEach.call(tables, function(table){  // si IE support
  tables.forEach( function(table){
    addCustomRollover(table, customFunction);
  });
}
*/

/*

function initBotegaRollover ()
{var tables = getElementsByClassName('roll', document);
var customFunction = function (objet, doOver)
{var id = objet.id;

while (id.length > 0)
{id =  id.substr (0, id.length - 1);
if (id != '')
{
if (e = document.getElementById(id)
)
{
doOver ? addClass(e, 'blu') : removeClass(e, 'blu');
}
}
}};
for (var i = 0, l = tables.length; i < l; ++i)
{addCustomRollover(tables[i], customFunction);}}
*/


// polyfill pour IE support
if (!NodeList.prototype.forEach) {
  // console.warn("define NodeList.prototype.forEach")
  NodeList.prototype.forEach = Array.prototype.forEach;
}
/**
 * par délégation sur les tables
 */
function initBotegaRollover() {
  // définition fonctions
  function customFunction(el, doOver) {
    let id = el.id;
    while (id.length > 1) {
      id = id.substr(0, id.length - 1);
      // récup. lower et Upper id
      const elems = document.querySelectorAll("#" + id + ",#" + id.toLowerCase());
      elems.forEach(function (el) {
        el.classList[doOver ? "add" : "remove"]("blu");
      });
    }
  }
 
  function handleMouse(e) {
    let elem = e.target;
    // recherche par selecteur
    while (elem && elem.tagName !== "TD") {
      elem = elem.parentNode;
    }
    if (elem) {
      customFunction(elem, "mouseover" === e.type);
    }
  }
  // affectation événements sur les tables
  const tables = document.querySelectorAll(".roll");
  tables.forEach(function (table) {
    table.addEventListener("mouseover", handleMouse);
    table.addEventListener("mouseout", handleMouse);
  });
}

window.addEventListener("load", initBotegaRollover);


              
            
!
999px

Console