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.
<input id="trigger" class="toggle-checkbox" type="checkbox"><label for="trigger">Throw the Switch</label>
<div class="bracket"><svg xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" clip-rule="evenodd" viewBox="0 0 337 334"><path fill="#b7b0b0" d="M217 296h25v-48h24v-34h27v-62h22V47h22V0H0v47h22v105h22v62h27v34h23v48h26v38h97v-38zm-38 1v10h-22v-10h-9v-22h9v-9h22v9h10v22h-10z"/></svg><div class="bracketbottom"></div></div>
<div class="shrinkray"><svg xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" clip-rule="evenodd" viewBox="0 0 958 383"><path fill="#696969" d="M289 28l196-1v327H290l-1-326z"/><path fill="#3d5070" d="M758 147h33v20h45v11h87v23h-87v12h-45v19h-33v28h-63V119h63v28z"/><path fill="#404040" d="M329-4l1 392-258 1v-34H51v-25H27v-27H1L0 81h26V53h24V28h21V-3l258-1z"/><path fill="#b0b0b0" d="M502 52l165-1v28l32-1 1 223h-33v27l-175 1 10-277z"/><path fill="#9f5f3a" d="M478 11h24v359h-24V11zM686 62h14v257h-14V62zM745 103h13v175h-13V103zM784 131h14v119h-14V131zM824 153h14v75h-14v-75zM940 166h8v9h9v29h-9v9h-8v8h-28v-8h-9v-9h-9v-29h9v-9h9v-8h28v8z"/></svg><div class="beam"></div></div>
<div class="scientist"><svg xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" clip-rule="evenodd" viewBox="0 0 208 374"><g transform="matrix(1.08695 0 0 1.04752 -4822 -2524)"><path fill="#3d5070" fill-rule="nonzero" d="M4491 2723v-71h81v23h1v48h-37v-39h-9v39h-36z"/><path fill="#60422d" fill-rule="nonzero" d="M4436 2584h33v35h-33zM4627 2584h-36v29h36z"/><path fill="#43703d" fill-rule="nonzero" d="M4591 2551h9v10h9v9h9v10h9v9h-27v15h-9v-9h-9v-6h-10v63h-81v-63h-55v-10h9v-9h9v-9h9v-10h9v-9h119v9z"/><path fill="#2d2d2d" fill-rule="nonzero" d="M4491 2645h81v9h-81zM4527 2766h-59v-36h23v-11h36v47zM4536 2719h37v11h23v36h-60v-47z"/><path fill="#60422d" fill-rule="nonzero" d="M4509 2525h45v26h-45z"/><path fill="#fff" fill-rule="nonzero" d="M4570 2542h21v9h9v10h9v9h9v10h9v9h-27v15h-9v-9h-9 1v67h2v37h-42v-5h-7v-27h-2v-49h2v-31h4v-11h1v-13h2v-11h3v-13h24v3zM4500 2542v-3h21v13h2v11h3v13h3v13h1v11h1v36h-4v48h-6v13h-21v8h-33v-18h4v-18h7v-17h5v-16h1v-47h-48v-10h9v-9h9v-9h9v-10h9v-9h28z"/><path fill="#1b1006" fill-rule="nonzero" d="M4563 2419h10v28h-82v-28h8v-10h64v10z"/><path fill="#7c5439" fill-rule="nonzero" d="M4564 2438h13v18h14v29h-10v28h-8v9h-9v10h-18v10h-28v-10h-18v-10h-9v-9h-10v-28h-9v-29h14v-18h14v-10h64v10z"/><path fill="#fff" fill-rule="nonzero" d="M4536 2447h31v29h-31zM4500 2447h27v29h-27z"/>
<path class="mouth" fill="#493222" fill-rule="nonzero" d="M4518 2504h27v9h-27z"/><g class="eyes"><path id="rteye" fill="#444445" fill-rule="nonzero" d="M63 45h9v9h-9z" transform="matrix(1.01311 0 0 1.05124 4454 2409)"/><path id="lteye" fill="#444445" fill-rule="nonzero" d="M108 36h9v9h-9z" transform="matrix(1.01311 0 0 1.05124 4447 2419)"/></g><path fill="#1b1006" fill-rule="nonzero" d="M4573 2438h9v37h-9zM4481 2438h10v37h-10z"/><path fill="#342217" d="M4529 2444h38l1 1 16 7v5h-2l-14-6v27l-1 2h-33l-1-2v-15h-3v15l-1 2h-33l-1-2v-27l-14 6h-2v-5l16-7 1-1h33zm-32 2v31h31v-31h-31zm69 0h-31v31h31v-31zm-33 0h-3v15h3v-15z"/><path fill="#1b1006" fill-rule="nonzero" d="M4577 2438h5v37h-5zM4481 2438h5v37h-5z"/><path fill="#60422d" fill-rule="nonzero" d="M4527 2466h9v28h-9z"/><path fill="silver" d="M4546 2586v40h-30v-7h-11l-1-1v-23l1-1h11v-8h30zm-30 30v-20h-10v20h10z"/><path fill="#fff" fill-rule="nonzero" d="M4523 2598v5h-2 1v-2h-3v2h1-2 1v-4h-1v-1h2v1h-1v1h3v-1h-1v-1h2zM4528 2603h-4v-3h1v3h1v-1h1v-2h-1 2v3zM4532 2600h3v3h-2 1v-3h-1v1h-1v2h1-2v-3 1h-1v2h1-2v-3h3zM4538 2601v-1h-1v1h1zm1 0v1h-2v1h1v-1h1v1h-3v-3h3v1zM4542 2601v1-2h1v1h-1v3h-1v1h-1v-1h1v-3h-1v-1h2-1v1h1zM4525 2605v1h1v1h-1v2h1v1h-2v-3h-1v-1h1v-1h1zM4529 2608v-1h-2v1h2zm0-1h1v1h-3v1h3-1v1h-2v-1h-1v-2h1v-1h2v1zM4533 2606v1h-2v2h2v1h-2v-1h-1v-2h1v-1h2zM4538 2607v3h-2v-1h1v-2h-2v2h1v1h-2v-5h1v2h1v-1h1v1h1z"/><g><path fill="#7c5439" fill-rule="nonzero" d="M4497 2588h8v9h6v19h-6v9h-27v-7h-35v-23h35v-7h1v-2h18v2z"/></g><g><path fill="#7c5439" fill-rule="nonzero" d="M4582 2601h45v28h-9v10h-18v-10h-9v-19h-9v-9z"/></g></g></svg></div>
<div class="z"><svg xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" clip-rule="evenodd" viewBox="0 0 277 497"><path fill="#443030" d="M197 329v145h-52v-90h-14v90H79V329h118z"/><path fill="#91c1a3" fill-rule="nonzero" d="M0 250h52v33H0zM276 250h-52v33h52z"/><path fill="#886546" d="M65 250v13H40v-13H0v-13h13v-13h13v-13h13v-14h14v-13h171v13h13v14h13v13h13v13h13v13h-39v13h-26v-13l-14 1v76H79v-76l-11-1h-3z"/><path fill="#4d4c4c" d="M79 322h118v13H79z"/><path fill="#232323" fill-rule="nonzero" d="M79 448v-17h53v66H46v-49h33zM197 448h33v49h-85v-66h52v17z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M13 263h66v13H65v27H53v13H26v-13H13v-13H0v-14h13v-13zM197 263h66v13h13v14h-13v13h-13v13h-27v-13h-12v-27h-14v-13z"/><path fill="#91c1a3" fill-rule="nonzero" d="M105 171h66v26h-66z"/><path fill="#3a3a3a" fill-rule="nonzero" d="M183 13h14v26H79V13h12V0h92v13z"/><path fill="#9cd3b3" fill-rule="nonzero" d="M185 39h12v27h27v40h-14v39h-13v13h-12v13h-26v13h-41v-13H92v-13H79v-13H66v-39H53V66h26V39h13V26h93v13z"/><g id="lefteye"><path fill="#fbeb8e" fill-rule="nonzero" d="M99 36h9v9h-9z" transform="matrix(4.90707 0 0 4.46262 -341 -108)"/><path fill="#444445" fill-rule="nonzero" d="M108 36h9v9h-9z" transform="scale(1.46262)"/></g><g id="righteye"><path fill="#fbeb8e" fill-rule="nonzero" d="M63 36h9v9h-9z" transform="matrix(4.35151 0 0 4.46262 -182 -108)"/><path fill="#444445" fill-rule="nonzero" d="M63 45h9v9h-9z" transform="scale(1.46262)"/></g><path fill="#758b7c" fill-rule="nonzero" d="M118 132h40v13h-40z"/><path fill="#91c1a3" fill-rule="nonzero" d="M132 79h13v39h-13z"/><path fill="#3a3a3a" fill-rule="nonzero" d="M197 39h14v53h-14zM66 39h13v53H66z"/></svg></div>
<div class="stage"></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 ~ .shrinkray .beam {
animation: 5s ease-in-out 0s beamer forwards;
}
.shrinkray .beam {
opacity: 0;
}
@keyframes beamer {
0% { opacity: 0;}
1%, 99% { opacity: 1; }
20% {
transform: scaleX(1);
}
100% { opacity: 0; transform: scaleX(0.9);}
}
.toggle-checkbox:checked ~ .scientist .eyes {
animation: 5s ease-in-out 0s lookup forwards;
}
.eyes {
transform: translateY( 0 );
}
@keyframes lookup {
0%, 60% {
transform: translateY( 0 );
}
100% {
transform: translateY( -0.5vw );
}
}
.toggle-checkbox:checked ~ .scientist .mouth{
animation: 5s ease-in-out 0s ohhh forwards;
}
.toggle-checkbox:checked ~ .z svg {
animation: 5s ease-in-out 0s reverseshrinkydink forwards;
}
@keyframes reverseshrinkydink {
0%, 20% {
transform: scale(0.2);
filter: drop-shadow(0 0 0.5vw yellow) drop-shadow(0 0 1vw yellow);
}
99% {
filter: drop-shadow(0 0 0.5vw yellow) drop-shadow(0 0 1vw yellow);
}
100% {
transform: scale(1);
filter: none;
}
}
.bracket {
width: 10vw;
position: absolute;
bottom: 40vw;
left: 15vw;
z-index: 10;
}
.bracketbottom {
height: 100vh;
width: 10vw;
background-color: #b7b0b0;
position: absolute;
top: -100vh;
}
.shrinkray {
width: 25vw;
position: absolute;
bottom: 37vw;
left: 15vw;
transform-origin: 20% 50%;
transform: rotate(25deg);
z-index: 9;
}
.beam {
position: absolute;
width: 43vw;
height: 0.5vw;
bottom: 5.05vw;
left: 24vw;
background-color: yellow;
z-index: -1;
box-shadow: 0 0 0.5vw yellow, 0 0 0.5vw yellow;
}
.scientist {
width: 15vw;
position: absolute;
bottom: 1vw;
left: 15vw;
}
.z {
width: 75vw;
position: absolute;
bottom: 3.5vw;
right: -15vw;
}
.z svg {
transform-origin: center bottom;
transform: scale(0.2);
}
.stage {
width: 30vw;
background-color: darkslategray;
height: 5vw;
position: absolute;
bottom: -1vw;
right: 7.5vw;
z-index: 0;
}
body {
background-color: lightskyblue;
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: 200px;
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