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 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.
<main>
<div id="wrap">
<div class="hand hand-left">
<span class='hand-part part-top'></span>
<span class='hand-part part-middle'></span>
<span class='hand-part part-bottom'></span>
</div>
<div class="hand hand-right">
<span class='hand-part part-top'></span>
<span class='hand-part part-middle'></span>
<span class='hand-part part-bottom'></span>
</div>
<div class='line line-1'>
<div class="ball">5</div>
</div>
<div class='line line-2'>
<div class="ball">0</div>
</div>
<div class='line line-3'>
<div class="ball">0</div>
</div>
<div id="server">
<div class="eye eye-left"><span></span></div>
<div class="eye eye-right"><span></span></div>
<div class="block">
<div class="light"></div>
</div>
<div class="block">
<div class="light"></div>
</div>
<div class="block">
<div class="light"></div>
</div>
<div class="block">
<div class="light"></div>
</div>
<div class="block">
<div class="light"></div>
</div>
<div id="bottom-block">
<div class="bottom-line"></div>
<div id="bottom-light"></div>
</div>
</div>
</div>
<div id="code-error">
<h1>Internal Server Error!</h1>
</div>
</main>
\:root
--block-background: #555
--block-border: 1px solid #000
--block-shadow: 0 0 0 2px rgba(255, 255, 255,0.2) inset
--block-light-background: linear-gradient(to right, #2579ba 0%,#0089f2 26%,#214db2 50%,#010023 51%,#0d0e19 100%)
--block-light-border: 5px solid
*
box-sizing: border-box
main
width: 100vw
height: 100vh
min-height: 450px
background: #fff
display: flex
flex-direction: column
justify-content: center
align-items: center
#wrap
width: 300px
height: 260px
display: flex
justify-content: center
align-items: flex-end
position: relative
.line
position: absolute
left: 0
top: 33%
width: 100%
&.line-1
animation: anim-line1 5s 0s ease forwards
.ball
animation-delay: 0
&.line-2
animation: anim-line2 5s 1.2s ease forwards
.ball
animation-delay: 1.2s
&.line-3
animation: anim-line3 5s 2.4s ease forwards
.ball
animation-delay: 2.4s
.ball
height: 40px
width: 40px
border-radius: 50%
background: #000
color: #fff
text-align: center
line-height: 40px
font-size: 30px
font-weight: bold
font-family: 'Source Code Pro', monospace
z-index: 2
animation: anim-ball 5s ease forwards
.hand
position: absolute
top: 50%
width: 100%
transform-origin: 50% 0
&.hand-left
left: 6px
animation: anim-hand-left 5s 0s ease forwards
.hand-part
height: 2px
width: 30px
background: #000
position: absolute
&.part-bottom
top: -10px
left: 0
height: 20px
border-radius: 7px
background: #ccc
border-bottom: 4px solid #000
&.part-middle
left: 26px
top: -10px
transform: rotate(-40deg)
&.part-top
left: 45px
top: -32px
transform: rotate(-60deg)
&.hand-right
right: 6px
animation: anim-hand-left 5s 0.5s ease forwards
.part-bottom
left: auto
right: 0
.part-middle
left: auto
right: 26px
transform: rotate(40deg)
.part-top
left: auto
right: 45px
transform: rotate(60deg)
#server
width: 150px
height: 250px
display: flex
flex-direction: column
justify-content: space-between
border: 3px solid #1C1000
padding-bottom: 2%
background: #1C1000
position: relative
.eye
position: absolute
top: -12px
width: 20px
height: 25px
border: 1px solid #000
box-shadow: 0 0 0 2px #ccc
background: #fff
border-radius: 50%
span
display: block
width: 50%
height: 50%
border: 1px solid
border-radius: 50%
background: #000
position: absolute
left: 0
top: 1px
animation: anim-eyes 8s ease forwards
&.eye-left
left: 30px
&.eye-right
right: 30px
.block
border: var(--block-border)
height: 11%
display: flex
justify-content: center
align-items: center
box-shadow: var(--block-shadow)
background: var(--block-background)
.light
width: calc(100% - 4px)
height: 12px
border-bottom: var(--block-light-border)
background: var(--block-light-background)
#bottom-block
height: 30%
border: var(--block-border)
display: flex
justify-content: center
align-items: center
background: var(--block-background)
box-shadow: var(--block-shadow)
overflow: hidden
position: relative
#bottom-light
width: 2vw
height: 2vw
min-width: 14px
min-height: 14px
border-radius: 4px
background: #fff
border: 2px solid #ccc
box-shadow: var(--block-shadow)
z-index: 2
.bottom-line
width: calc(100% - 4px)
height: 3px
background: #fff
position: absolute
border-bottom: 2px solid #ccc
#code-error
width: 60%
min-width: 320px
text-align: center
h1
font-family: 'Source Code Pro', monospace
font-size: 4vw
font-weight: bold
margin: 1vw 0
@keyframes anim-ball
20%
transform: rotate(180deg)
40%
transform: rotate(0deg)
60%
transform: rotate(180deg)
80%
transform: rotate(0deg)
100%
transform: rotate(-90deg)
@keyframes anim-line1
20%
transform: rotate(180deg)
40%
transform: rotate(0deg)
60%
transform: rotate(180deg)
80%
transform: rotate(0deg)
100%
transform: rotate(90deg) translateY(40px)
@keyframes anim-line2
20%
transform: rotate(180deg)
40%
transform: rotate(0deg)
60%
transform: rotate(180deg)
80%
transform: rotate(0deg)
100%
transform: rotate(90deg)
@keyframes anim-line3
20%
transform: rotate(180deg)
40%
transform: rotate(0deg)
60%
transform: rotate(180deg)
80%
transform: rotate(0deg)
100%
transform: rotate(90deg) translateY(-40px)
@keyframes anim-hand-left
10%
transform: rotate(3deg)
15%
transform: rotate(0deg)
25%
transform: rotate(3deg)
30%
transform: rotate(0deg)
40%
transform: rotate(3deg)
45%
transform: rotate(0deg)
50%
transform: rotate(3deg)
55%
transform: rotate(0deg)
65%
transform: rotate(3deg)
70%
transform: rotate(0deg)
80%
transform: rotate(3deg)
85%
transform: rotate(0deg)
95%
transform: rotate(3deg)
100%
transform: rotate(0deg)
@keyframes anim-hand-right
10%
transform: rotate(-3deg)
15%
transform: rotate(0deg)
25%
transform: rotate(-3deg)
30%
transform: rotate(0deg)
40%
transform: rotate(-3deg)
45%
transform: rotate(0deg)
50%
transform: rotate(-3deg)
55%
transform: rotate(0deg)
65%
transform: rotate(-3deg)
70%
transform: rotate(0deg)
80%
transform: rotate(-3deg)
85%
transform: rotate(0deg)
100%
transform: rotate(0deg)
@keyframes anim-eyes
25%
left: 10px
50%
left: 0
75%
top: 0
left: 10px
100%
top: 7px
left: 5px
Also see: Tab Triggers