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">Action!</label>
<div class="spotlights">
<div id="1" class="spotlight"></div>
<div id="2" class="spotlight"></div>
<div id="3" class="spotlight"></div>
<div id="4" class="spotlight"></div>
</div>
<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)">
<g><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" d="M4577 293h2l3 15 2 14-8 20-9-40 10-9z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M4579 295l-4-12-6 2 4 13z"/><path fill="#676767" d="M4406 295l-3-1-2 14v15l8 17 7-39-10-6z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M4403 295l3-12 7 1-3 13z"/><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"/><path fill="#9e6330" d="M4542 253l-15 5-19 6-15 3-19-2-19-5-17-2-11-2-14 115 18 7 18 5 22 4 22 2 19-4 21-6 21-1 13-7-15-119-10 1z"/><path fill="#774b24" d="M4471 263h8l-5 126h-7zM4489 265h8v127h-8zM4505 261h8l3 127h-7zM4523 256h7l6 126-8 1zM4538 250l7-1 13 131-7 1z"/><path fill="#581610" d="M4406 325l6-68 4 1 1-4h4l1-4h4v-4h5l-13 145-4-1v-4h-4v-4l-4-1v-4h-4l4-52zm163 61l-21-138h5v4l5-1v4h5l1 3h4l10 69 7 44h-5l1 4-5 1 1 4-4 1v4l-4 1z"/><path fill="#774b24" d="M4452 258h8l-8 127-8-1zM4437 254l7 1-12 126-7-1z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M4565 304l-1-6 15-3 4 27-15 2-1-6-6 1-2-14 6-1z"/><path fill="#330d09" d="M4566 292l5-1 6 39-5 1z"/><path fill="#48120d" d="M4567 297l5-1 4 29-5 1z"/><path fill="#6b6108" d="M4567 293l2-1 1 2-2 1zM4573 327h2v2h-2z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M4417 317l-1 7-15-1 2-28 15 2v6l6 1-1 14-6-1z"/><path fill="#330d09" d="M4416 291l-5-1-3 40 5 1z"/><path fill="#48120d" d="M4416 296h-6l-2 29h5z"/><path fill="#6b6108" d="M4415 292h-2l-1 2h2zM4412 327l-2-1-1 3h2z"/></g>
</g></svg>
</div>
<div class="backer">
<svg 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="#111" fill-rule="nonzero" d="M4459 178h1v-15h6v-7h48v7h8v15h7v14h7v22h-8v22h-6v7h-7v7h-7v8h15v-2h7v1l8-3-1-4h8v3l4-1-1-4h5v4l5-1v4h5l1 3h4l4 26 3-1 3 10h1l3 15 2 14-5 12 6 37h-5l1 4-5 1 1 4-4 1v4l-4 1-2-15-9 5v4l-7 1-1-3-15 1v3l-7 1v-3l-4 1v37h25v30h-54v-56h-6v-3h-2v7h1v52h-55v-30h26v-34l-7-1v2l-8-1v-2l-11-4-1 3-7-1v-4l-5-3-2 18-4-1v-4h-4v-4l-4-1v-4h-4l4-44-5-10v-15l2-14v1l3-12 4 1 2-27 4 1 1-4h4l1-4h4v-4h5l-1 11 6 1 1-4 7 1v4h1v-1h28v-8h-7v-7h-7v-7h-7v-22h-7v-22h7v-14h7z"/></g></svg>
</div>
<div class="background"></div>
<div class="note">* Note: Works best in Safari (That surprised me too)</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>
.toggle-checkbox:checked ~ .spotlights {
animation: 10s ease-in-out 0s movespotlight forwards;
}
@keyframes movespotlight {
0% {
left: 5vw;
top: 4vw;
}
50%, 51% {
left: 44.5vw;
top: 4vw;
}
60%, 100% {
left: 41vw;
top: 1.5vw;
}
}
.spotlights{
position: relative;
top: 4vw;
left: 5vw;
z-index: 100;
}
.toggle-checkbox:checked ~ .spotlights .spotlight {
animation: 10s ease-in-out 0s growspotlight forwards;
}
@keyframes growspotlight{
0%, 51% {
width: 11vw;
height: 11vw;
}
60%, 100% {
width: 16vw;
height: 16vw;
}
}
.spotlight {
width: 11vw;
height: 11vw;
background-image: url("https://assets.codepen.io/1804713/spotlight.svg");
mix-blend-mode: overlay;
position: absolute;
top: 0;
left: 0;
}
#zombie {
width: 10vw;
top: 6vw;
left: 45vw;
position: absolute;
mix-blend-mode: multiply;
z-index: 10;
}
.backer {
width: 10vw;
top: 6vw;
left: 45vw;
position: absolute;
}
.music {
width: 10vw;
position: absolute;
top: 2vw;
left: 45vw;
z-index: 10;
}
#zombie {
filter: drop-shadow(1vw 0px 1px rgba(0, 0,0, 0.75) );
}
.toggle-checkbox:checked ~ .z .musicnote {
animation: 4s ease-in-out calc( var(--multiplier) * 2s ) 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); }
}
.background {
background-color: #660000;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
mix-blend-mode: multiply;
z-index: -1;
}
body {
background-color: #111;
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;
}
.note {
color: #FFF;
font-style: italic;
width: 100%;
text-align: center;
position: absolute;
bottom: 1vh;
}
Also see: Tab Triggers