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.
.loadster
.loadster__body
.body__gum
.loadster__mask
.loadster__head
.head__face
.head__ear
.head__eye
.head__horn
.horn__circle
.head__smile
.head__hand
.loadster__bottom
.bottom__foot
$size: 300px
$border-size: 4px
$color-main: #EEDAD1
$color-border: #373D46
$color-body: #89b793
$color-light: #FFFFCC
$color-add: #99CCA4
body
background-color: $color-main
font-size: 16px
.loadster
position: relative
margin: 10em auto
width: $size + $border-size*2
height: $size + $border-size*2
&__body
position: absolute
width: $size
height: $size
border: $border-size solid $color-border
border-radius: 50%
background-color: $color-body
&::before
content: ''
position: absolute
width: $size/1.5
height: $size/1.5
top: $size/2 - $size/3 - $border-size
left: $size/2 - $size/3 - $border-size
border: $border-size solid $color-border
border-radius: 50%
background-color: $color-main
&::after
content: ''
position: absolute
top: 3*$size/26 - $border-size*6
left: 3*$size/26 - $border-size*6
width: $size/1.3
height: $size/1.3
border: $border-size*6 solid $color-add
border-radius: 50%
&__mask
position: absolute
width: 50%
height: 50%
background-color: $color-main
transform-origin: right bottom
&::before
content: ''
position: absolute
left: 100%
width: 100%
height: 100%
background-color: $color-main
transform-origin: left bottom
&::after
content: ''
position: absolute
top: 100%
width: 100%
height: 100%
background-color: $color-main
transform-origin: right top
&__head
position: absolute
top: 0
right: 0
width: 50%
height: 50%
background-color: $color-main
transform-origin: left bottom
&__bottom
position: absolute
left: 0
bottom: 0
width: 50%
height: 50%
background-color: $color-main
transform-origin: right top
.head__face
position: absolute
bottom: 0
right: 0
width: $size/6 - $border-size
height: $size/6
background-color: $color-body
border: $border-size solid $color-border
border-bottom: 0
border-radius: 50% 50% 0 0
.head__ear
position: absolute
top: $size/3 - $size/20
right: ($size/6 - $border-size)/3 - $size/15
width: $size/20
height: $size/15
background-color: $color-body
border: $border-size solid $color-border
border-radius: 50% 0
border-top: 0
border-right: 0
&::before
content: ''
position: absolute
top: 0
right: ($size/6 - $border-size)/1.9 + $size/15
width: $size/20
height: $size/15
background-color: $color-body
border: $border-size solid $color-border
border-radius: 0 50%
border-top: 0
border-left: 0
.head__horn
position: absolute
top: $size/3.7
right: ($size/6 - $border-size)/2 - $border-size*1.5
width: 0
height: $size/22
border: $border-size solid $color-border
border-left: 0
&::before
content: ''
position: absolute
top: -$border-size
right: ($size/6 - $border-size)/4
width: 0
height: $size/22
border: $border-size solid $color-border
border-right: 0
.horn__circle
position: absolute
top: -$size/22
right: -$size/35
width: $size/70
height: $size/70
background-color: $color-body
border: $border-size solid $color-border
border-radius: 50%
&::before
content: ''
position: absolute
top: -$border-size
right: $size/35 + $border-size/1.5
width: $size/70
height: $size/70
background-color: $color-body
border: $border-size solid $color-border
border-radius: 50%
.head__eye
position: absolute
top: $size/2.8
right: ($size/6 - $border-size)/2 - $border-size*3
width: $size/70
height: $size/70
background-color: $color-light
border: $border-size solid $color-border
border-radius: 50%
&::before
content: ''
position: absolute
top: -$border-size
right: -$border-size + $size/15
width: $size/70
height: $size/70
background-color: $color-light
border: $border-size solid $color-border
border-radius: 50%
.head__smile
content: ''
position: absolute
top: $size/2.5
right: ($size/6 - $border-size)/2 - $border-size*6
width: $size/6
height: $size/50
border: $border-size solid $color-border
border-top: 0
border-radius: 50%
.head__hand
position: absolute
width: $size/5
height: $size/6
top: $size/2.2
right: -$border-size*2
border: $border-size solid
border-color: transparent $color-border transparent transparent
border-radius: 0 0 50% 0
transform: rotate(10deg)
&::before
content: ''
position: absolute
width: $size/5
height: $size/6
top: 0
right: ($size/6 - $border-size)
border: $border-size solid
border-color: transparent $color-border transparent transparent
border-radius: 0 0 50% 0
.bottom__foot
position: absolute
bottom: 0
right: 0
width: $size/8
height: $size/25
background-color: $color-body
border: $border-size solid $color-border
border-right: 0
border-radius: 100% 0 0 0
&::before
content: ''
position: absolute
bottom: -2*$border-size + $size/6 - $size/25
right: 0
width: $size/8
height: $size/25
background-color: $color-body
border: $border-size solid $color-border
border-right: 0
border-radius: 0 0 0 100%
&::after
content: ''
position: absolute
bottom: $size/25
right: 0
width: 0
height: $size/6 - $size/25*2 - $border-size*4
border: $border-size solid $color-border
border-left: 0
.loadster__mask
transform: rotate(40deg)
animation: mask-circle 2s 1s infinite
&::before
animation: mask-circle-right 2s 1s infinite
&::after
animation: mask-circle-left 2s 1s infinite
.loadster__head
transform: rotate(40deg)
animation: head-circle 2s 1s infinite
animation-timing-function: cubic-bezier(.2,0,.1,1)
.loadster__bottom
animation: bottom-circle 2s 1s infinite
animation-timing-function: cubic-bezier(.2,0,.42,1)
@keyframes mask-circle
0%
transform: rotate(0deg)
100%
transform: rotate(-720deg)
@keyframes mask-circle-right
0%
transform: rotate(0deg)
50%
transform: rotate(-90deg)
100%
transform: rotate(0deg)
@keyframes mask-circle-left
0%
transform: rotate(0deg)
50%
transform: rotate(90deg)
100%
transform: rotate(0deg)
@keyframes head-circle
0%
transform: rotate(0deg)
100%
transform: rotate(-720deg)
@keyframes bottom-circle
0%
transform: rotate(-10deg)
100%
transform: rotate(-730deg)
Also see: Tab Triggers