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 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.
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.
If the stylesheet 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 CSS 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.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<input id="trigger" class="toggle-checkbox" type="checkbox"><label for="trigger">Dance!</label>
<div class="z">
<svg class="music" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" clip-rule="evenodd" viewBox="0 -100 244 396">
<g transform="matrix(1.32759 0 0 1.27943 -5843 -177)">
<g id="n3" class="musicnote"><path fill="#2f2f2f" fill-rule="nonzero" d="M202 103l4-23 2 1 3 1v1h1v1h1l5 1 1 1v1h1v2h1v1l1 1h1v2l-1-1v1h-4v-1h-2v-1h-4v1l-4-1v-1h-2l-3 19h-1l-1 2h-1v1h-1v1l-2-1v1h-3v-1l-2-1v-1h-1v-1h-1v-1h6v-1h2v-1h3v-1h-5v1h-1v-1l-2 1v-1l-2 1h-1v-2h1l1-2h1v-1h1v-1l2 1v-1h3v1l2 1v1h1z" transform="matrix(.75325 0 0 .7816 4397 135)"/></g>
<g id="n6" class="musicnote"><path fill="#2f2f2f" fill-rule="nonzero" d="M18 28l2-23h3v1h2v1h2l-1 1h6v1h2l-1 2h2v2h1v1h1v1h1v1h-2l-1 1h-2v-1h-1v-1h-3v1l-2-1v1h-4l1-1h-2l-3 19h-1v2h-1v1h-1v1h-2l-1 1-3-1 1-1H8l1-1H8v-1H7v-1h2v-1h5v-1h1v-1h2v-1h-3v1H7l-1 1v-2h1l1-2h1v-1h1v-1h2v-1h3v1l2 1v1h1z" transform="matrix(.75325 0 0 .7816 4397 135)"/></g>
<g id="n4" class="musicnote"><path fill="#2f2f2f" fill-rule="nonzero" d="M29 62l1-7h2l-1 13h-1l-1 2h-1v1h-1v1h-2v1h-3v-1h-2v-1l-1-1v-1h-1v-2h-1l1-3h1v-2h1v-1h1v-1h2v-1l3 1v1h2v1h1zm2-13l-1 6h-2l2-16h2v1h3v1h1v1h6v1h1v1h2l-1 2h1v1h2v1h1v1h-1v1h-4l-2-1h-4v1l-4-1h-2z" transform="matrix(.75325 0 0 .7816 4407 134)"/></g>
<g id="n5" class="musicnote"><path fill="#2f2f2f" fill-rule="nonzero" d="M221 29h3v1l1-1v1h2v-1h6v1h1l1 2h1v1l2-1v1h1v1h-1v1h-1v1h-4l-1-1-2 1-2 1v1h-5l1 7 1-1 3 13h-1v2l-1 1v1h-1l1 1h-2v1l-3 1v-1h-2l-1-1h-1v-1h-1v-2l-1 1-1-3 1-1v-2h1v-1h1l-1-1h2v-1l3-1v1h2l1 1v-1l-1-6h-1l-3-16 2-1v1z" transform="matrix(.75325 0 0 .7816 4397 135)"/></g>
<g id="n2" class="musicnote"><path fill="#2f2f2f" fill-rule="nonzero" d="M227 133l1-7h2l-1 13h-1v2h-1l-1 1-1 1h-2v1h-3v-1l-2-1v-1h-1v-1h-1l1-2h-1v-3h1v-2h1v-1h1v-1h2v-1l3 1v1h2v1h1zm2-14v7h-3l2-16h2l3 1v1h1v1h1v-1l5 1v1h1v1h2l-1 2h2l-1 1h2v1h1v1h-3v1h-2v-1h-2l-2-1v1h-6v-1h-2z" transform="matrix(.75325 0 0 .7816 4397 135)"/></g>
<g id="n1" class="musicnote"><path fill="#2f2f2f" fill-rule="nonzero" d="M31 104l3 13h-1v2l-1 1v1h-1v1h-2v1l-3 1v-1h-2v-1h-1v-1h-1l-1-2h-1v-3h1v-2h1l-1-1h1v-1l2-1v-1h3v1h2l1 1v-1l-1-6 2-1zm-1-15l3-1v1h1v1h2v-1l4-1v1h2v1h1l1 2h1v1l1-1 1 1h1v1h-1v1h-2v1h-2v-1l-2 1v-1l-2 1-2 1-3 1v-1h-3m-1-9h-2l2 17 3-1-3-16z" transform="matrix(.75325 0 0 .7816 4392 143)"/></g>
<g id="n7" class="musicnote"><path id="n7" fill="#2f2f2f" fill-rule="nonzero" d="M190 22l2 13h-1l1 2h-1v1h-1v1l-2 1v1h-3v-1l-2 1v-1h-1v-1h-1l-1-2-1 1v-3l1-1-1-2h1v-1h1v-1l2-1v-1h3v1l2-1v1h1l-2-7h3zm-3-16h3v1l2-1v1h1l4-1h2v1h2v2h1l1 1 1-1v1h1v1h-1v1h-1v1h-4v-1l-2 1-2 1v1h-6l2 7h-2l-4-16h2z" transform="matrix(.75325 0 0 .7816 4397 135)"/></g>
</g></svg>
<svg id="zombie" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" clip-rule="evenodd" viewBox="0 0 244 396"><g transform="matrix(1.32759 0 0 1.27943 -5843 -177)"><path fill="#676767" fill-rule="nonzero" d="M4445 258h91v36h-91z"/><path fill="#91c1a3" fill-rule="nonzero" d="M4473 244h35v21h-35z"/><path fill="#3a3a3a" fill-rule="nonzero" d="M4514 163h8v15h-62v-15h6v-7h48v7z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M4515 178h7v14h14v22h-8v22h-6v7h-7v7h-14v8h-21v-8h-14v-7h-7v-7h-7v-22h-7v-22h14v-14h7v-7h49v7z"/><path fill="#fbeb8e" fill-rule="nonzero" d="M4494 185h23v22h-23zM4466 185h21v22h-21z"/><path fill="#758b7c" fill-rule="nonzero" d="M4480 229h8v7h-8z"/><path fill="#91c1a3" fill-rule="nonzero" d="M4487 200h7v21h-7z"/><path fill="#444445" fill-rule="nonzero" d="M4466 192h7v8h-7zM4501 185h7v7h-7z"/><path fill="#3a3a3a" fill-rule="nonzero" d="M4522 178h7v29h-7zM4452 178h7v29h-7z"/><path fill="#676767" fill-rule="nonzero" d="M4487 403h1v45h-55v-30h26v-45h28v30z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M4459 396h29v7h-29z"/><path fill="#676767" fill-rule="nonzero" d="M4495 403v-30h29v45h25v30h-54v-45z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M4524 396h-29v7h29z"/>
<g id="accordion"><path fill="#9e6330" d="M805 523l-81 29-101 28-78 19-103-10-102-30-95-8-57-11-75 593 96 38 96 25 118 19 121 16 102-24 109-32 116-4 68-36-78-613-56 1z" transform="matrix(.1864 0 0 .1934 4392 151)"/><path fill="#774b24" d="M-96 243h40v654h-40z" transform="matrix(.18627 .00697 -.00671 .19328 4491 216)"/><path fill="#774b24" d="M-96 243h40v654h-40z" transform="matrix(.1864 0 0 .1934 4507 218)"/><path fill="#774b24" d="M-96 243h40v654h-40z" transform="matrix(.18632 -.0055 .0053 .19333 4522 214)"/><path fill="#774b24" d="M-96 243h40v654h-40z" transform="matrix(.18622 -.00834 .00804 .19323 4539 209)"/><path fill="#774b24" d="M-96 243h40v654h-40z" transform="matrix(.18538 -.02015 .02012 .19931 4550 200)"/><path fill="#774b24" d="M-96 243h40v654h-40z" transform="matrix(.186 .01247 -.01201 .193 4473 212)"/><path fill="#774b24" d="M-96 243h40v654h-40z" transform="matrix(.18553 .01854 -.01787 .19251 4459 209)"/></g>
<g id="zright"><path fill="#676767" d="M986 743l21-4 14 69 9 75-32 91-59-193 47-38z" transform="matrix(-.18539 .02006 .01933 .19236 4575 132)"/><path fill="#9cd3b3" fill-rule="nonzero" d="M45 180h9v9h-9z" transform="matrix(.3357 -1.40534 .71215 .18316 4260 326)"/><path fill="#581610" d="M12 244l8-87h5l1-5h6v-5h6l1-5 6 1-17 184h-6l1-5-6-1v-5l-6-1 1-5-6-1 6-65z" transform="matrix(.75325 0 0 .7816 4397 135)"/><path fill="#9cd3b3" fill-rule="nonzero" d="M26 233l-1 9-20-2 3-35 20 2-1 8 9 1-2 18-8-1z" transform="matrix(.75325 0 0 .7816 4397 135)"/><path fill="#330d09" d="M940 740h21v186h-21z" transform="matrix(-.25064 -.0232 -.01853 .21552 4666 153)"/><path fill="#48120d" d="M940 740h21v186h-21z" transform="matrix(-.25064 -.0232 -.01322 .15371 4661 205)"/><path fill="#6b6108" d="M951 764h11v11h-11z" transform="matrix(-.18565 -.01725 -.01662 .19264 4604 161)"/><path fill="#6b6108" d="M951 764h11v11h-11z" transform="matrix(-.18565 -.01725 -.01662 .19264 4601 196)"/></g>
<g id="zleft"><path fill="#676767" d="M993 733h13l15 75 9 75-44 104-47-206 54-48z" transform="matrix(.1864 0 0 .1934 4392 151)"/><path fill="#9cd3b3" fill-rule="nonzero" d="M45 180h9v9h-9z" transform="matrix(-.47435 -1.36163 -.69 .2588 4725 310)"/><path fill="#581610" d="M228 321l-27-176 6-1 1 5h5l1 5 6-1 1 5 6-1 13 89 9 55-6 2 1 5-6 1 1 5-6 1 1 5-6 1z" transform="matrix(.75325 0 0 .7816 4397 135)"/><path fill="#9cd3b3" fill-rule="nonzero" d="M223 216l-1-8 19-3 5 35-19 2-1-8-9 1-3-17 9-2z" transform="matrix(.75325 0 0 .7816 4397 135)"/><path fill="#330d09" d="M940 740h21v186h-21z" transform="matrix(.24863 -.04024 .03214 .21379 4308 171)"/><path fill="#48120d" d="M940 740h21v186h-21z" transform="matrix(.24863 -.04024 .02292 .15248 4316 222)"/><path fill="#6b6108" d="M951 764h11v11h-11z" transform="matrix(.18416 -.02986 .02878 .19109 4370 175)"/><path fill="#6b6108" d="M951 764h11v11h-11z" transform="matrix(.18416 -.02986 .02878 .19109 4376 209)"/></g>
</g></svg>
</div>
<div class="logo"><a href="https://undead.institute" target="_blank"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1804713/UndeadInsti-LogoOnWhite.png" alt="Getting Braaains should be fun"></a></div>
#zombie {
width: 10vw;
top: 6vw;
left: 45vw;
position: absolute;
z-index: 10;
}
.music {
width: 10vw;
position: absolute;
top: 2vw;
left: 45vw;
z-index: 10;
}
.toggle-checkbox:checked ~ .z .musicnote {
animation: 4s ease-in-out calc( var(--multiplier) * 1s - 1s ) notes forwards infinite;
}
.musicnote {
width: 1vw;
height: 2vw;
opacity: 0;
}
#n1 { --multiplier: 1 }
#n2 { --multiplier: 1.2 }
#n3 { --multiplier: 1.4 }
#n4 { --multiplier: 1.6 }
#n5 { --multiplier: 1.8 }
#n6 { --multiplier: 2 }
#n7 { --multiplier: 2.2 }
@keyframes notes {
0% {opacity: 0; transform: translateY(0); }
30%, 80% {opacity: 1;}
100% {opacity: 0; transform: translateY(-2vw); }
}
.toggle-checkbox:checked ~ .z #zleft, .toggle-checkbox:checked ~ .z #zright {
animation: 4s ease-in-out 0s play forwards infinite;
}
#zright { --multiplier: 1; transform-origin: 0 0; transform: translateX(0) rotate(0); }
#zleft { --multiplier: -1; transform-origin: 0 0; transform: translateX(0) rotate(0); }
@keyframes play {
0%, 100% { transform: translateX(0) rotate(0); }
50% { transform: translate( calc( var(--multiplier) * 30px ), calc( var(--multiplier) * -156px ) ) rotate( calc( var(--multiplier) * 2deg ) ); }
}
.toggle-checkbox:checked ~ .z #accordion {
animation: 4s ease-in-out 0s squeeze forwards infinite;
}
#accordion { transform-origin: center center; transform: scaleX(1); }
@keyframes squeeze {
0%, 100% { transform: scaleX(1); }
50% { transform: scaleX(0.8) translateX( 1085px ); }
}
body {
background-color: #DF96F1;
overflow: hidden;
}
.logo {
width: 100%;
max-width: 400px;
position: absolute;
top: 0;
right: 0;
}
.logo img {
width: 100%;
}
input{
display: none;
}
input:checked + label {
box-shadow: inset 3px 3px 2px #660000;
transform: translate(3px, 3px);
}
label {
font-size: 1.5em;
color: #FFF;
background-color: #960B0B;
width: 140px;
height: 30px;
text-align: center;
font-weight: bold;
display: block;
border-radius: 7px;
box-shadow: 3px 3px 0 #660000;
cursor: pointer;
position: relative;
z-index: 1000;
}
Also see: Tab Triggers