HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<table role="table" class="compcab" id="test">
<thead role="rowgroup"><tr role="row"><th></th><th role="columnheader" scope="col">Intitulé</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é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 €</i></del></td><td role="cell"><del>7,42 €</del></td><td role="cell"><a href="nouscab.php#DS" class="pp">Indisponible - définitivement</a></td><td role="cell"><span title="EAN : 3548388477177">847717_Des</span> <a title="Fiche référence 847717_Des PDF" href="db/pdf/847717.pdf">[ pdf ]</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 €</i></td><td role="cell">5,41 €</td><td role="cell">5-7 jours</td><td role="cell"><span title="EAN : 3548389730875">973087_Des</span> <a title="Fiche référence 973087_Des PDF" href="db/pdf/973087.pdf">[ pdf ]</a></td></tr>
<tr role="row" class="moins"><td role="cell"><input type="radio" title="Cordon RJ45 Cat5e, F/UTP, 20 m, jaune" name="super" value="973107_Des~25#0#0G" /></td><td role="cell"><em>-25 % (jusqu'au 11 janvier)</em>Cordon RJ45 Cat5e, F/UTP, 20 m</td><td role="cell">jaune</td><td role="cell"><del><i>6,31 €</i></del><ins>4,73 €</ins></td><td role="cell"><del>7,57 €</del><ins>5,68 €</ins></td><td role="cell"><em>153-155 jours</em></td><td role="cell"><span title="EAN : 3548389731070">973107_Des</span> <a title="Fiche référence 973107_Des PDF" href="db/pdf/973107.pdf">[ pdf ]</a></td></tr>
<tr class="puce"><td colspan="5"><em>-25 % (jusqu'au 11 janvier)</em></td><td>Prix HT : 4,73 €</td><td>5,68 € 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 m, vert" name="super" value="973097_Des" /></td><td role="cell">Cordon RJ45 Cat5e, F/UTP, 20 m</td><td role="cell">vert</td><td role="cell"><del><i>4,56 €</i></del></td><td role="cell"><del>5,47 €</del></td><td role="cell"><a href="nouscab.php#DS" class="pp">Indisponible - définitivement</a></td><td role="cell"><span title="EAN : 3548389730974">973097_Des</span> <a title="Fiche référence 973097_Des PDF" href="db/pdf/973097.pdf">[ pdf ]</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 €</i></td><td role="cell">18,50 €</td><td role="cell"><em>149-151 jours</em></td><td role="cell"><span title="EAN : 3548382467631">246763_Des</span> <a title="Fiche référence 246763_Des PDF" href="db/pdf/246763.pdf">[ pdf ]</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É, Cat6, U/UTP, 3 m, gris" name="super" value="855944_Des" /></td><td role="cell">Cordon RJ45 CROISÉ, Cat6, U/UTP, 3 m</td><td role="cell">gris</td><td role="cell"><del><i>1,40 €</i></del></td><td role="cell"><del>1,68 €</del></td><td role="cell"><a href="nouscab.php#DS" class="pp">Indisponible - définitivement</a></td><td role="cell"><span title="EAN : 3524898559442">855944_Des</span> <a title="Fiche référence 855944_Des PDF" href="db/pdf/855944.pdf">[ pdf ]</a></td></tr>
<tr role="row"><td role="cell"><input type="radio" title="Cordon RJ45 Cat6a, U/FTP, armé anti-rongeur, 1 m, gris" name="super" value="859411_Des~25#0#0G" /></td><td role="cell"><em>-25 % (jusqu'au 11 janvier)</em>Cordon RJ45 Cat6a, U/FTP, armé anti-rongeur, 1 m</td><td role="cell">gris</td><td role="cell"><del><i>4,78 €</i></del><ins>3,59 €</ins></td><td role="cell"><del>5,74 €</del><ins>4,31 €</ins></td><td role="cell">5-7 jours</td><td role="cell"><span title="EAN : 3548388594119">859411_Des</span> <a title="Fiche référence 859411_Des PDF" href="db/pdf/859411.pdf">[ pdf ]</a></td></tr>
<tr class="puce plus"><td colspan="5"><em>-25 % (jusqu'au 11 janvier)</em></td><td>Prix HT : 3,59 €</td><td>4,31 € TTC</td></tr>
</table>
: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}
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';
}
*/
Also see: Tab Triggers