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.
<h1><selectmenu> plain </h1>
<selectmenu>
<optgroup label="Optgroup 1">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 539845734587982374</option>
</optgroup>
<optgroup label="Optgroup 2">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 5</option>
</optgroup>
</selectmenu>
<span><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></span>
<h1><selectmenu> styled</h1>
<selectmenu class="styled">
<optgroup label="Optgroup 1">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 539845734587982374</option>
</optgroup>
<optgroup label="Optgroup 2">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 5</option>
</optgroup>
</selectmenu>
<span><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></span>
<h1><selectmenu> filled with lots of strange stuff</h1>
<p>Link, SVG image, table, input, another select menu, datepicker, YouTube Live stream embed</p>
<selectmenu class="filled">
<optgroup label="Optgroup 1">
<option><a href="https://wwsiv.de">WWSIV</a></option>
<option>SVG <br>
<svg style="width: 100px;" viewBox="0 0 235.15756 223.20731"><g id="wwsiv_svg_logo"><linearGradient id="ee_rainbow" x1="0" x2="0" y1="0" y2="1" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#F00"></stop><stop offset="0.1667" stop-color="#F00"></stop><stop offset="0.1667" stop-color="#FF9800"></stop><stop offset="0.3333" stop-color="#FF9800"></stop><stop offset="0.3333" stop-color="#FF0"></stop><stop offset="0.5" stop-color="#FF0"></stop><stop offset="0.5" stop-color="#009800"></stop><stop offset="0.6667" stop-color="#009800"></stop><stop offset="0.6667" stop-color="#00F"></stop><stop offset="0.8333" stop-color="#00F"></stop><stop offset="0.8333" stop-color="#980098"></stop><stop offset="1.00" stop-color="#980098"></stop></linearGradient><linearGradient id="ee_bi" x1="0" x2="0" y1="0" y2="1" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#D60270"></stop><stop offset="0.4" stop-color="#D60270"></stop><stop offset="0.4" stop-color="#9B4F96"></stop><stop offset="0.6" stop-color="#9B4F96"></stop><stop offset="0.6" stop-color="#0038A8"></stop><stop offset="1" stop-color="#0038A8"></stop></linearGradient><linearGradient id="ee_trans" x1="0" x2="0" y1="0" y2="1" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#5BCEFA"></stop><stop offset="0.2" stop-color="#5BCEFA"></stop><stop offset="0.2" stop-color="#F5A9B8"></stop><stop offset="0.4" stop-color="#F5A9B8"></stop><stop offset="0.4" stop-color="#FFFFFF"></stop><stop offset="0.6" stop-color="#FFFFFF"></stop><stop offset="0.6" stop-color="#F5A9B8"></stop><stop offset="0.8" stop-color="#F5A9B8"></stop><stop offset="0.8" stop-color="#5BCEFA"></stop><stop offset="1" stop-color="#5BCEFA"></stop></linearGradient><linearGradient id="ee_enby" x1="0" x2="0" y1="0" y2="1" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#FCF434"></stop><stop offset="0.25" stop-color="#FCF434"></stop><stop offset="0.25" stop-color="#FCFCFC"></stop><stop offset="0.5" stop-color="#FCFCFC"></stop><stop offset="0.5" stop-color="#9C59D1"></stop><stop offset="0.75" stop-color="#9C59D1"></stop><stop offset="0.75" stop-color="#2C2C2C"></stop><stop offset="1" stop-color="#2C2C2C"></stop></linearGradient><linearGradient id="ee_fluid" x1="0" x2="0" y1="0" y2="1" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#ff75a2"></stop><stop offset="0.2" stop-color="#ff75a2"></stop><stop offset="0.2" stop-color="#ffffff"></stop><stop offset="0.4" stop-color="#ffffff"></stop><stop offset="0.4" stop-color="#be18d6"></stop><stop offset="0.6" stop-color="#be18d6"></stop><stop offset="0.6" stop-color="#000000"></stop><stop offset="0.8" stop-color="#000000"></stop><stop offset="0.8" stop-color="#333ebd"></stop><stop offset="1" stop-color="#333ebd"></stop></linearGradient><g fill="#f00" style="isolation:isolate" transform="matrix(0.34253886,0,0,0.34253886,484.41073,89.249015)"><path d="m -738.19378,106.12091 c -21.6769,37.5455 -69.6875,50.40989 -107.23299,28.73299 -37.54549,-21.6769 -50.4099,-69.68749 -28.73299,-107.232989 21.6769,-37.5455011 69.6875,-50.409894 107.23299,-28.7329941 37.54549,21.6769001 50.4099,69.6874931 28.73299,107.2329931" style="isolation:isolate;fill:var(--yellow);fill-opacity:1;stroke-width:4.36111116"></path><ellipse transform="rotate(30)" ry="11.993056" rx="10.902778" cy="454.45862" cx="-690.90076" style="isolation:isolate;fill:#664500;stroke-width:4.36111116"></ellipse><ellipse transform="rotate(30)" ry="15.263889" rx="10.902778" cy="454.45862" cx="-638.5675" style="isolation:isolate;fill:#664500;stroke-width:4.36111116"></ellipse><path d="m -835.4723,22.557459 c 0.55664,1.207676 1.65331,2.142989 3.04814,2.439672 18.76827,4.012396 25.33175,17.415119 25.60241,17.984319 1.03058,2.166175 3.62181,3.10324 5.79499,2.08679 2.17308,-1.016501 3.12094,-3.591439 2.11633,-5.767793 -0.33533,-0.727396 -8.49531,-17.871894 -31.68691,-22.831676 -2.35727,-0.504887 -4.67483,0.99725 -5.17374,3.352984 -0.20986,0.956495 -0.0795,1.908011 0.29878,2.735704 z m 91.17609,41.808581 c -1.38989,-0.80245 -2.40983,-2.20206 -2.67046,-3.91363 -1.45049,-9.655085 -9.0691,-21.788653 -12.90265,-24.001953 -2.4247,-1.3999 -9.25686,-0.756857 -13.25396,0.243922 -2.92433,0.738888 -5.88287,-1.044768 -6.61262,-3.9588 -0.73348,-2.916182 1.03073,-5.875882 3.94163,-6.617494 2.30535,-0.582594 14.16115,-3.280438 21.3786,0.886562 7.57262,4.37205 16.43294,19.841115 18.23604,31.824873 0.45036,2.97934 -1.60347,5.75168 -4.57688,6.20037 -1.27583,0.19501 -2.51234,-0.0707 -3.53962,-0.6638 z" style="isolation:isolate;fill:#664500;stroke-width:4.36111116"></path><path d="m -784.12557,110.09791 c -0.32123,-0.99621 -1.3041,-1.61404 -2.33507,-1.49414 -0.21052,0.0244 -21.13638,2.40068 -39.18209,-8.01802 -18.00034,-10.3925 -26.45452,-29.73124 -26.53486,-29.92368 -0.41168,-0.95274 -1.44252,-1.48748 -2.4615,-1.27516 -1.01737,0.21833 -1.74408,1.12824 -1.72436,2.16689 0.0184,1.09332 0.71741,26.8168 24.17908,40.3624 23.46167,13.5456 46.09217,1.29142 47.0444,0.7585 0.91155,-0.50604 1.33782,-1.58436 1.0144,-2.57679 z" style="isolation:isolate;fill:#664500;stroke-width:4.36111116"></path></g><g fill="#00f" transform="matrix(0.34269805,0,0,0.34269805,724.82375,-370.41153)" style="isolation:isolate"><g><path d="m -2072.1776,1561.8888 -42.8731,-481.0203 h 471.6117 l -42.8732,481.0203 -193.4525,54.3783" style="isolation:isolate;fill:var(--pink);fill-opacity:0.6;stroke-width:4.15038109"></path><path id="logo_shield" d="m -1990.1298,1637.6025 -42.8731,-481.0207 h 471.6117 l -42.8731,481.0207 -192.9327,54.3779 z" style="isolation: isolate; fill: var(--pink); fill-opacity: 1; stroke: var(--purple); stroke-width: 77.4075; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1; paint-order: stroke markers;"></path><path d="m -1797.197,1650.1521 155.8097,-42.8718 36.5977,-412.0087 h -192.4074" style="isolation:isolate;fill:#ffffff;fill-opacity:0.23137255;stroke-width:4.15038109"></path><g transform="matrix(1.0460428,0,0,1.0460428,82.747235,-50.818143)"><path id="logo_W_left" style="isolation: isolate; fill: rgb(235, 235, 235); stroke-width: 3.9677; fill-opacity: 1;" d="m -1882.911,1248.4688 -56.2317,-0.248 24.9918,287.9036 57.7395,14.8956 59.2144,-151.4932 v -83.7508 l -13.3741,-0.064 -55.7704,121.8532 z"></path><path id="logo_W_right" style="isolation:isolate;fill:#ffffff;fill-opacity:1;stroke-width:3.96769691" d="m -1711.4806,1248.4688 56.2309,-0.248 -24.9938,287.9036 -57.7375,14.8956 -59.216,-151.4932 v -83.7508 l 13.3831,-0.064 55.7708,121.8532 z"></path></g></g></g></g></svg></option>
<option>HTML<br>
<h1>headline</h1>
<ul>
<li>List item</li>
<li>List item</li>
</ul>
</option>
<option><input type="text"></option>
<option>
<selectmenu>
<optgroup label="Optgroup 1">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 539845734587982374</option>
</optgroup>
<optgroup label="Optgroup 2">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 5</option>
</optgroup>
</selectmenu>
</option>
<option>Option 539845734587982374</option>
</optgroup>
<optgroup label="Optgroup 2">
<option>INPUT DATE<input type="date"></option>
<option>YOUTUBE VIDEO <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/jfKfPfyJRdk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></option>
<option>RANGE INPUT
<input type="range" id="volume" name="volume"
min="0" max="11"></option>
<option>Option 4</option>
<option>Option 5</option>
</optgroup>
</selectmenu>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>BOO!
:root {
--rainbow-bg: linear-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.styled {
font-size: 20px;
width: 500px;
height: 60px;
border-radius: 10px;
}
.styled::part(button) {
width: 100%;
height: 100%;
padding: 1rem;
background-color: peachPuff;
font-size: 40px;
border-radius: 10px;
color: white;
}
.styled::part(selected-value) {
background: red;
padding: 1rem;
}
.styled::part(listbox) {
background: black;
padding: 1rem;
border-radius: 100px;
min-height: 200px;
}
.styled, .styled * {
background: var(--rainbow-bg);
}
.styled *:focus {
background: #fff;
}
.filled {
font-size: 20px;
width: 500px;
height: 200px;
border-radius: 10px;
}
.filled::part(listbox) {
max-height: 70vh;
}
:where(.styled, .filled) optgroup {
text-align: center;
}
/************************************************************/
body {
background: #222;
height: 100vh;
font-family: sans-serif;
color: white;
line-height: 1.5;
letter-spacing: 1px;
margin-top: 2rem;
max-width: 500px;
margin: 0 auto;
}
* {
box-sizing: border-box;
}
Also see: Tab Triggers