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.
<div class="container">
<section class="showcase first">
<h1>Laziness</h1>
<div class="code">
<div class="virtue laziness">L</div>
<div class="virtue laziness">a</div>
<div class="virtue laziness">z</div>
<div class="virtue laziness">i</div>
<div class="virtue laziness">n</div>
<div class="virtue laziness">e</div>
<div class="virtue laziness">s</div>
<div class="virtue laziness">s</div>
</div>
<div class="wall"></div>
</section>
<div class="quote">
The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don't have to answer so many questions about it.
</div>
<section class="showcase second">
<h1>Impatience</h1>
<div class="code">
<div class="virtue impatience">I</div>
<div class="virtue impatience">m</div>
<div class="virtue impatience">p</div>
<div class="virtue impatience">a</div>
<div class="virtue impatience">t</div>
<div class="virtue impatience">i</div>
<div class="virtue impatience">e</div>
<div class="virtue impatience">n</div>
<div class="virtue impatience">c</div>
<div class="virtue impatience">e</div>
</div>
<div class="wall"></div>
</section>
<div class="quote">
The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to.
</div>
<section class="showcase third">
<h1>Hubris</h1>
<div class="wall"></div>
</section>
<div class="quote">
The quality that makes you write (and maintain) programs that other people won't want to say bad things about.
</div>
</div>
@import url('https://fonts.googleapis.com/css?family=VT323|Notable');
$dark: #201f1d;
$white: #fcf9f3;
$green: #3aee3a;
$verdana: 'Notable', verdana;
$arial: 'VT323', arial;
body {
background: $dark;
}
.container {
margin: auto;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
margin: 20px;
}
.showcase {
width: 600px;
height: 200px;
border: solid 2px $green;
border-radius: 10px;
position: relative;
overflow: hidden;
}
h1 {
font-family: $verdana;
font-size: 80px;
position: absolute;
color: $white;
text-shadow: 5px 5px 2px rgba(0, 0, 0, 0.5);
}
.first > h1 {
animation: appear-left 1s linear 1;
animation-fill-mode: forwards;
animation-delay: 6s;
left: 600px;
}
.second > h1 {
animation: appear-down 1s linear 1;
animation-fill-mode: forwards;
animation-delay: 6s;
top: -200px;
}
.third > h1 {
animation: scale-down 6s steps(6) 1;
animation-fill-mode: forwards;
}
.first > .code {
position: absolute;
top: 0px;
left: 100px;
animation: move-right 1s linear 1;
animation-fill-mode: forwards;
animation-delay: 5s;
}
.second > .code {
position: absolute;
top: 0px;
left: 0px;
animation: move-up 1s linear 1 ;
animation-fill-mode: forwards;
animation-delay: 5s;
}
.wall {
background: repeating-linear-gradient(
45deg,
$dark,
$dark 10px,
$green 10px,
$green 20px
);
}
.first > .wall {
position: absolute;
top: 0px;
left: 0px;
height: 200px;
width: 100px;
border-radius: 5px;
animation: wipe-h 2s linear 1;
animation-delay: 5s;
}
.second > .wall {
position: absolute;
top: 150px;
left: 0px;
width: 600px;
height: 100px;
border-radius: 5px;
animation: wipe-v 2s linear 1 ;
animation-delay: 5s;
}
.third > .wall {
position: absolute;
top: 0px;
left: 600px;
width: 200px;
height: 200px;
border-radius: 5px;
animation: appear-right 1s linear 1 ;
animation-fill-mode: forwards;
animation-delay: 6s;
}
.virtue {
color: $white;
font-family: $verdana;
font-size: 80px;
text-shadow: 5px 5px 2px rgba(0, 0, 0, 0.5);
}
/* animations */
@keyframes move-right {
0% {
visibility: visible;
transform: translateX(0px);
}
99% {
transform: translateX(600px);
}
100% {
transform: translateX(600px);
visibility: hidden;
}
}
@keyframes move-up {
0% {
visibility: visible;
transform: translateY(0px);
}
99% {
transform: translateY(-400px);
}
100% {
transform: translateY(-400px);
visibility: hidden;
}
}
@keyframes wipe-h {
0% { transform: translateX(0px); }
50% { transform: translateX(600px); }
100% { transform: translateX(0px); }
}
@keyframes wipe-v {
0% { transform: translateY(0px); }
50% { transform: translateY(-300px); }
100% { transform: translateY(0px); }
}
@keyframes scale-down {
0% { transform: scale(5); }
100% { transform: scale(1); }
}
@keyframes appear-left {
0% { transform: translateX(0px); }
100% { transform: translateX(-500px); }
}
@keyframes appear-right {
0% { transform: translateX(0px); }
100% { transform: translateX(-200px); }
}
@keyframes appear-down {
0% { transform: translateY(0px); }
100% { transform: translateY(190px); }
}
.laziness, .impatience {
position: absolute;
visibility: hidden;
}
@for $i from 1 through 8 {
.laziness:nth-of-type(#{$i}) {
color: $white;
animation-name: mess#{$i};
animation-duration: 6s;
animation-iteration-count: 1;
animation-timing-function: linear;
transform: rotateZ(random(100)+deg) translateX(50+random(100)+px);
}
@keyframes mess#{$i} {
0% { visibility: visible; transform: rotateZ(random(100)+deg) translateX(50+random(100)+px); }
25% { transform: rotateZ(random(100)+deg) translateX(50+random(100)+px); }
50% { transform: rotateZ(random(100)+deg) translateX(50+random(100)+px); }
75% { transform: rotateZ(random(100)+deg) translateX(50+random(100)+px); }
99% { transform: rotateZ(random(100)+deg) translateX(50+random(100)+px); }
100% { visibility: hidden; }
}
}
@for $i from 1 through 10 {
.impatience:nth-of-type(#{$i}) {
color: $white;
animation-name: drop#{$i};
animation-duration: 1s;
animation-iteration-count: 6;
animation-timing-function: linear;
animation-direction: alternate-reverse;
transform: translateY(random(100)+px) translateX(#{$i*45}px);
}
@keyframes drop#{$i} {
0% { visibility: visible; transform: translateY(random(100)+px) translateX(#{$i*45}px) }
33% { transform: translateY(random(100)+px) translateX(#{$i*45}px) }
66% { transform: translateY(random(100)+px) translateX(#{$i*45}px) }
100% { transform: translateY(random(100)+px) translateX(#{$i*45}px) }
}
}
.quote {
width: 600px;
color: $green;
font-family: $arial;
font-size: 24px;
font-weight: normal;
bottom: 15px;
padding: 10px;
line-height: 110%;
}
// A famous quote from Larry Wall
// http://threevirtues.com/
Also see: Tab Triggers