Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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 role="table" class="compcab" id="test">
<thead role="rowgroup"><tr role="row"><th></th><th role="columnheader" scope="col">Intitul&eacute;</th><th role="columnheader" scope="col">Couleur</th><th role="columnheader" scope="col">Prix HT</th><th role="columnheader" scope="col">Prix TTC</th><th role="columnheader" scope="col"><a href="nouscab.php#DS">Chez vous en...</a></th><th role="columnheader" scope="col">R&eacute;f. fabricant</th></tr></thead>
<tbody role="rowgroup">
<tr role="row" title="847717_Des est indisponible. Ne pas ajouter au panier."><td role="cell"><input type="radio" title="Cordon RJ45 Cat5e, F/UTP, 20 m, jaune" name="super" value="847717_Des" /></td><td role="cell">Cravate en soie</td><td role="cell">jaune</td><td role="cell"><del><i>6,18&nbsp;&euro;</i></del></td><td role="cell"><del>7,42&nbsp;&euro;</del></td><td role="cell"><a href="nouscab.php#DS" class="pp">Indisponible - d&eacute;finitivement</a></td><td role="cell"><span title="EAN : 3548388477177">847717_Des</span>&nbsp;<a title="Fiche r&eacute;f&eacute;rence 847717_Des PDF" href="db/pdf/847717.pdf">&#91;&nbsp;pdf&nbsp;&#93;</a></td></tr>
<tr role="row" class="odd"><td role="cell"><input type="radio" title="Cordon RJ45 Cat5e, F/UTP, 20 m, rouge" name="super" value="973087_Des" /></td><td role="cell">Cravate en cotton</td><td role="cell">rouge</td><td role="cell"><i>4,51&nbsp;&euro;</i></td><td role="cell">5,41&nbsp;&euro;</td><td role="cell">5-7 jours</td><td role="cell"><span title="EAN : 3548389730875">973087_Des</span>&nbsp;<a title="Fiche r&eacute;f&eacute;rence 973087_Des PDF" href="db/pdf/973087.pdf">&#91;&nbsp;pdf&nbsp;&#93;</a></td></tr>
<tr role="row" class="moins"><td role="cell"><input type="radio" title="Cordon RJ45 Cat5e, F/UTP, 20&nbsp;m, jaune" name="super" value="973107_Des~25#0#0G" /></td><td role="cell"><em>-25 % (jusqu&#039;au 11 janvier)</em>Cordon RJ45 Cat5e, F/UTP, 20&nbsp;m</td><td role="cell">jaune</td><td role="cell"><del><i>6,31&nbsp;&euro;</i></del><ins>4,73&nbsp;&euro;</ins></td><td role="cell"><del>7,57&nbsp;&euro;</del><ins>5,68&nbsp;&euro;</ins></td><td role="cell"><em>153-155 jours</em></td><td role="cell"><span title="EAN : 3548389731070">973107_Des</span>&nbsp;<a title="Fiche r&eacute;f&eacute;rence 973107_Des PDF" href="db/pdf/973107.pdf">&#91;&nbsp;pdf&nbsp;&#93;</a></td></tr>
<tr class="puce"><td colspan="5"><em>-25 % (jusqu&#039;au 11 janvier)</em></td><td>Prix HT : 4,73&nbsp;&euro;</td><td>5,68&nbsp;&euro; TTC</td></tr>
<tr role="row" title="973097_Des est indisponible. Ne pas ajouter au panier." class="odd"><td role="cell"><input type="radio" title="Cordon RJ45 Cat5e, F/UTP, 20&nbsp;m, vert" name="super" value="973097_Des" /></td><td role="cell">Cordon RJ45 Cat5e, F/UTP, 20&nbsp;m</td><td role="cell">vert</td><td role="cell"><del><i>4,56&nbsp;&euro;</i></del></td><td role="cell"><del>5,47&nbsp;&euro;</del></td><td role="cell"><a href="nouscab.php#DS" class="pp">Indisponible - d&eacute;finitivement</a></td><td role="cell"><span title="EAN : 3548389730974">973097_Des</span>&nbsp;<a title="Fiche r&eacute;f&eacute;rence 973097_Des PDF" href="db/pdf/973097.pdf">&#91;&nbsp;pdf&nbsp;&#93;</a></td></tr>
<tr role="row"><td role="cell"><input type="radio" title="Cordon RJ45 Cat6, U/UTP, 25 m, bleu" name="super" value="246763_Des" /></td><td role="cell">Cordon RJ45 Cat6, U/UTP, 25 m</td><td role="cell">bleu</td><td role="cell"><i>15,42&nbsp;&euro;</i></td><td role="cell">18,50&nbsp;&euro;</td><td role="cell"><em>149-151 jours</em></td><td role="cell"><span title="EAN : 3548382467631">246763_Des</span>&nbsp;<a title="Fiche r&eacute;f&eacute;rence 246763_Des PDF" href="db/pdf/246763.pdf">&#91;&nbsp;pdf&nbsp;&#93;</a></td></tr>
<tr role="row" title="855944_Des est indisponible. Ne pas ajouter au panier." class="odd"><td role="cell"><input type="radio" title="Cordon RJ45 CROIS&Eacute;, Cat6, U/UTP, 3&nbsp;m, gris" name="super" value="855944_Des" /></td><td role="cell">Cordon RJ45 CROIS&Eacute;, Cat6, U/UTP, 3&nbsp;m</td><td role="cell">gris</td><td role="cell"><del><i>1,40&nbsp;&euro;</i></del></td><td role="cell"><del>1,68&nbsp;&euro;</del></td><td role="cell"><a href="nouscab.php#DS" class="pp">Indisponible - d&eacute;finitivement</a></td><td role="cell"><span title="EAN : 3524898559442">855944_Des</span>&nbsp;<a title="Fiche r&eacute;f&eacute;rence 855944_Des PDF" href="db/pdf/855944.pdf">&#91;&nbsp;pdf&nbsp;&#93;</a></td></tr>

<tr role="row"><td role="cell"><input type="radio" title="Cordon RJ45 Cat6a, U/FTP, arm&eacute; anti-rongeur, 1&nbsp;m, gris" name="super" value="859411_Des~25#0#0G" /></td><td role="cell"><em>-25 % (jusqu&#039;au 11 janvier)</em>Cordon RJ45 Cat6a, U/FTP, arm&eacute; anti-rongeur, 1&nbsp;m</td><td role="cell">gris</td><td role="cell"><del><i>4,78&nbsp;&euro;</i></del><ins>3,59&nbsp;&euro;</ins></td><td role="cell"><del>5,74&nbsp;&euro;</del><ins>4,31&nbsp;&euro;</ins></td><td role="cell">5-7 jours</td><td role="cell"><span title="EAN : 3548388594119">859411_Des</span>&nbsp;<a title="Fiche r&eacute;f&eacute;rence 859411_Des PDF" href="db/pdf/859411.pdf">&#91;&nbsp;pdf&nbsp;&#93;</a></td></tr>
<tr class="puce plus"><td colspan="5"><em>-25 % (jusqu&#039;au 11 janvier)</em></td><td>Prix HT : 3,59&nbsp;&euro;</td><td>4,31&nbsp;&euro; TTC</td></tr>
</table>
              
            
!

CSS

              
                :root
{
--blanc: #FFFFFF;
--noir: #0E1D2D;
--gris-fonce: #666E72;
--rouge: #D6503A;
--vert: #55906E;
--bleu-favicon: #175269;
--ariane-clair: #EDF0F1;
}

table {white-space: nowrap}

.compcab td > ins, .compcab td:nth-child(2) > em {display: none}
.compcab th, table.compcab i {font-weight: normal; color: var(--gris-fonce)}
.compcab tr > td {padding: 0.3em 1em; vertical-align: middle; text-align: left}
table.compcab tr > th {padding: 10px 1em; vertical-align: middle; text-align: center; white-space: nowrap}
.compcab td:nth-child(4), .compcab td:nth-child(5) {text-align: right}
.compcab tr > td:first-child {padding-right: 0}

tr.puce td {color: var(--gris-fonce)}
tr.puce td:last-child {text-align: right; color: var(--noir)}
tr.plus {border-bottom: 1px dotted var(--gris-fonce)}
.compcab tr.moins > td {padding-bottom: 0}
.compcab input[type="text"] {margin: 0 3p}
tr.odd {background-color: var(--ariane-clair)}
del {text-decoration: line-through}
.compcab a:link, .compcab a:visited {color: var(--gris-fonce); cursor: help; text-decoration: underline}
.compcab a.pr:link, .compcab a.pr:visited {text-decoration: none}
.compcab tr td:last-child a:link, .compcab tr td:last-child a:visited {color: var(--bleu-favicon); cursor: pointer; text-decoration: none}
table.compcab td > a.pp:link, table.compcab td > a.pp:visited, .compcab td:nth-child(6) > em {color: var(--rouge)}
.compcab a:hover, .compcab tr td:last-child a:hover, table.compcab td a.pp:hover {color: var(--bleu-favicon); text-decoration: none}

em {font-weight: normal}
tr.puce em {font-style: normal; color: var(--vert)}


table.compcab trois {display: grid; width: 100%; padding-top: 0.6em; padding-bottom: 0.6em}
.compcab trois thead, .compcab trois tr.puce {display: none}
.compcab trois td > ins, .compcab trois td:nth-child(2) > em {display: block; color: var(--vert)}

.compcab trois td > ins {text-decoration: none}

table.compcab trois > tbody > tr > td {text-align: center !important; line-height: 1.5em}

.compcab trois tr {display: grid; grid-template-columns: 40px 0.5fr 0.25fr 0.25fr; grid-template-areas: "input titre ht ttc" "input titre delai delai" "input couleur fab fab"}

.compcab trois tr > td:first-child {display: grid; grid-area: input; padding: 0; border-right: 1px dotted var(--gris-fonce)}

.compcab trois tr > td:nth-child(2) {grid-area: titre; padding: 1em 1em 0 1em}
 
.compcab trois tr > td:nth-child(3) {grid-area: couleur; padding: 0 1em 1em 1em; margin-top: auto}

.compcab trois tr > td:nth-child(4) {grid-area: ht; padding: 1em 0 0 1em; border-left: 1px dotted var(--gris-fonce)}
.compcab trois tr > td:nth-child(4):not(:has(del))::after {content: " HT"; color: var(--gris-fonce)}
.compcab trois tr > td:nth-child(4) > del::after {content: " HT"; color: var(--gris-fonce)}
.compcab trois tr > td:nth-child(4) > ins::after {content: " HT"}

.compcab trois tr > td:nth-child(5) {grid-area: ttc; padding: 1em 1em 0 0}
.compcab trois tr > td:nth-child(5):not(:has(del))::after {content: " TTC"}
.compcab trois tr > td:nth-child(5) > del::after {content: " TTC"}
.compcab trois tr > td:nth-child(5) > ins::after {content: " TTC"}

.compcab trois tr > td:nth-child(6) {grid-area: delai / span 2; padding: 0 1em; border-left: 1px dotted var(--gris-fonce)}
.compcab trois tr > td:nth-child(6)::before {content: "Chez vous en : "}
  
.compcab trois tr > td:nth-child(7) {grid-area: fab / span 2; padding: 0 1em 1em 1em; border-left: 1px dotted var(--gris-fonce)}

.compcab trois tr[title*="indisponible."] > td:nth-child(2)::before {content: "Indisponible définitivement"; display: block; color: var(--rouge)} 
.compcab trois tr[title*="indisponible."] > td:nth-child(6) > a {display: none}
.compcab trois tr[title*="indisponible."] > td:nth-child(6)::before {content: "(ne pas ajouter au panier)"}

.compcab trois td:first-child > input {display: block; margin: auto}
              
            
!

JS

              
                var w = document.documentElement.clientWidth;

console.log("Largeur de la fenêtre:", w);

var test = document.getElementById('test');

console.log("Élément test:", test);

var t = test.offsetWidth;

console.log("Largeur de l'élément:", t);


if (t < w)
{
document.getElementById('test').classList.add = 'trois';
}
else
{
document.getElementById('test').classList.remove = 'trois';
}

/*
if (window.matchMedia("(max-width: 2000px)").matches)
{
document.getElementById('test').className = 'compcab trois';
}
*/
              
            
!
999px

Console