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="pl">
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__dot"></div>
<div class="pl__text">Loading…</div>
</div>
*
border: 0
box-sizing: border-box
margin: 0
padding: 0
$hue: 223
\:root
--bg: #{hsl($hue,10%,30%)}
--fg: #{hsl($hue,10%,90%)}
--fg-t: #{hsla($hue,10%,90%,0.5)}
--primary1: #{hsl($hue,90%,55%)}
--primary2: #{hsl($hue,90%,65%)}
--trans-dur: 0.3s
font-size: calc(16px + (20 - 16) * (100vw - 320px) / (1280 - 320))
body
background:
color: var(--bg)
image: linear-gradient(135deg,hsla(0,0%,0%,0),hsla(0,0%,0%,0.2))
color: var(--fg)
font: 1em/1.5 "Varela Round", Helvetica, sans-serif
height: 100vh
min-height: 360px
display: grid
place-items: center
transition: background-color var(--trans-dur), color var(--trans-dur)
.pl
box-shadow: 2em 0 2em hsla(0,0%,0%,0.2) inset, -2em 0 2em hsla(0,0%,100%,0.1) inset
display: flex
justify-content: center
align-items: center
position: relative
letter-spacing: 0.1em
text-transform: uppercase
transform: rotateX(30deg) rotateZ(45deg)
width: 15em
height: 15em
&,
&__dot
border-radius: 50%
&__dot
$dur: 2s
animation-name: shadow
box-shadow: 0.1em 0.1em 0 0.1em hsl(0,0%,0%), 0.3em 0 0.3em hsla(0,0%,0%,0.5)
top: calc(50% - 0.75em)
left: calc(50% - 0.75em)
width: 1.5em
height: 1.5em
&,
&:before,
&:after
animation-duration: $dur
animation-iteration-count: infinite
position: absolute
&:before,
&:after
content: ""
display: block
left: 0
width: inherit
transition: background-color var(--trans-dur)
&:before
animation-name: pushInOut1
background-color: var(--bg)
border-radius: inherit
box-shadow: 0.05em 0 0.1em hsla(0,0%,100%,0.2) inset
height: inherit
z-index: 1
&:after
animation-name: pushInOut2
background-color: var(--primary1)
border-radius: 0.75em
box-shadow: 0.1em 0.3em 0.2em hsla(0,0%,100%,0.4) inset, 0 (-0.4em) 0.2em #{hsl($hue,10%,20%)} inset, 0 (-1em) 0.25em hsla(0,0%,0%,0.3) inset
bottom: 0
clip-path: polygon(0 75%, 100% 75%, 100% 100%, 0 100%)
height: 3em
transform: rotate(-45deg)
transform-origin: 50% 2.25em
$dots: 12
$zIndices: (5,4,3,2,1,1,2,3,4,5,6,6)
@for $i from 1 through $dots
&:nth-child(#{$i})
$angle: 360deg / $dots * ($i - 1)
transform: rotate(-$angle) translateX(5em) rotate($angle)
z-index: nth($zIndices,$i)
&,
&:before,
&:after
animation-delay: $dur * (-($i - 1) / $dots)
&__text
font-size: 0.75em
max-width: 5rem
position: relative
text-shadow: 0 0 0.1em var(--fg-t)
transform: rotateZ(-45deg)
/* Animations */
@keyframes shadow
from
animation-timing-function: ease-in
box-shadow: 0.1em 0.1em 0 0.1em hsl(0,0%,0%), 0.3em 0 0.3em hsla(0,0%,0%,0.3)
25%
animation-timing-function: ease-out
box-shadow: 0.1em 0.1em 0 0.1em hsl(0,0%,0%), 0.8em 0 0.8em hsla(0,0%,0%,0.5)
50%,
to
box-shadow: 0.1em 0.1em 0 0.1em hsl(0,0%,0%), 0.3em 0 0.3em hsla(0,0%,0%,0.3)
@keyframes pushInOut1
from
animation-timing-function: ease-in
background-color: var(--bg)
transform: translate(0,0)
25%
animation-timing-function: ease-out
background-color: var(--primary2)
transform: translate(-71%,-71%)
50%,
to
background-color: var(--bg)
transform: translate(0,0)
@keyframes pushInOut2
from
animation-timing-function: ease-in
background-color: var(--bg)
clip-path: polygon(0 75%, 100% 75%, 100% 100%, 0 100%)
25%
animation-timing-function: ease-out
background-color: var(--primary1)
clip-path: polygon(0 25%, 100% 25%, 100% 100%, 0 100%)
50%,
to
background-color: var(--bg)
clip-path: polygon(0 75%, 100% 75%, 100% 100%, 0 100%)
Also see: Tab Triggers