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.
svg#Rocket(xmlns='http://www.w3.org/2000/svg', viewbox='0 0 140 170')
g#Rocket-fill
path.light(d='M68.336 13.36c-4.054 0-6.136-1.01-6.222-1.052l.443-.896c.02.01 1.986.948 5.78.948 3.746 0 5.764-.94 5.783-.95l.435.9c-.09.043-2.22 1.05-6.218 1.05')
path.dark(d='M68.336 17.36c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0 1c2.206 0 4 1.794 4 4s-1.794 4-4 4-4-1.794-4-4 1.794-4 4-4')
path.light(d='M70.836 22.36c-.276 0-.5-.224-.5-.5 0-.827-.673-1.5-1.5-1.5-.276 0-.5-.224-.5-.5s.224-.5.5-.5c1.38 0 2.5 1.12 2.5 2.5 0 .276-.224.5-.5.5')
path.dark(d='M71.336 33.36h-6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2m0 1c.55 0 1 .45 1 1v10c0 .55-.45 1-1 1h-6c-.55 0-1-.45-1-1v-10c0-.55.45-1 1-1h6')
path.light(d='M61.573 53.85c-3.133 1.01-6.557 3.45-8.187 9.102-.03.104-.052.183-.074.244l-.05.136c-5.28-15.116 1.568-25.657 4.632-29.853-.043-.52-.08-1.03-.108-1.536-2.39 3.22-11.396 14.79-5.46 31.745.143.403.4.67.945.67.695 0 .854-.467.988-.84.273-.76 1.705-7.903 9.447-9.16h-2s-.05-.186-.133-.51m17.274-21.962c-.035.523-.074 1.05-.12 1.58l.01-.05c3.04 4.155 9.98 14.727 4.676 29.915-.018-.045-.036-.096-.05-.136-.022-.06-.044-.14-.074-.244-1.632-5.654-5.055-8.094-8.188-9.104l-.132.51h-2c7.742 1.257 9.174 8.4 9.448 9.16.133.373.292.84.987.84.545 0 .802-.267.944-.67 5.97-17.05-3.172-28.658-5.5-31.803')
path.dark(d='M68.336.36s-11 14.11-11 29c0 9.95 4 25 4 25h14s4-15.056 4-26c0-12.128-11-28-11-28m-.04 1.756c2.487 3.872 10.04 16.444 10.04 26.244 0 9.316-2.986 21.845-3.777 25H62.11c-.792-3.14-3.776-15.54-3.776-24 0-11.982 7.433-23.63 9.96-27.244')
path.light(d='M68.336 35.36c-1.65 0-3 1.35-3 3s1.35 3 3 3 3-1.35 3-3-1.35-3-3-3m0 1c1.103 0 2 .897 2 2s-.897 2-2 2-2-.897-2-2 .897-2 2-2m-9.49 19.102l-4-19 .98-.204 4 19-.98.204zm18.98 0l-.98-.204 4-19 .98.204-4 19z')
path.dark(d='M74.336 53.36h-12l.72 4.33c.162.963.997 1.67 1.974 1.67h6.612c.977 0 1.812-.707 1.973-1.67l.72-4.33zm-1.18 1l-.528 3.164c-.08.485-.495.836-.986.836H65.03c-.49 0-.905-.35-.986-.836l-.528-3.164h9.64z')
g#Flame
path.flame-1(d='M78.766 68.896c2.927 2.928 4.538 6.82 4.537 10.96l.546 52.327c-.002.277-.225.5-.502.5-.276 0-.5-.224-.5-.5l-.544-52.326c0-3.875-1.507-7.515-4.245-10.254-2.74-2.74-6.38-4.248-10.253-4.25-3.874-.002-7.515 1.507-10.254 4.245-2.74 2.738-4.25 6.38-4.25 10.252l.144 37.477c0 .277-.225.5-.5.5-.278 0-.5-.224-.502-.5l-.14-37.477c0-4.14 1.613-8.032 4.54-10.96 2.93-2.926 6.82-4.537 10.962-4.536 4.14 0 8.032 1.614 10.96 4.542')
path.flame-2(d='M64.617 100.005c.09.09.146.217.147.354l-.01 43.84c0 .276-.224.5-.5.5-.277 0-.5-.224-.5-.5l.01-43.84c0-.278.223-.5.5-.502.137 0 .263.057.353.147')
path.flame-3(d='M73.606 88.14c.09.09.145.217.147.354l-.01 43.84c0 .277-.224.5-.5.5-.277 0-.5-.223-.5-.5l.008-43.84c.002-.277.226-.5.502-.5.138 0 .263.056.354.146')
- var n = 5
- for (var i = 1; i < 50; i++) {
svg(id="star-" + i, xmlns='http://www.w3.org/2000/svg', viewbox='0 0 64 48')
path.light-star(d='M58.813 17.106l4.62 1.044c.756.208.756 1.282 0 1.49l-4.62 1.044c-.388.095-.692.364-.8.71l-1.268 4.933c-.208.757-1.282.757-1.49 0l-1.27-4.934c-.106-.345-.41-.614-.798-.71l-4.62-1.043c-.757-.208-.757-1.282 0-1.49l4.62-1.044c.388-.095.69-.365.798-.71l1.27-4.933c.207-.757 1.282-.757 1.49 0l1.27 4.933c.106.346.41.615.798.71m-48 21.104l4.62 1.045c.756.208.756 1.282 0 1.49l-4.62 1.044c-.388.093-.692.362-.8.707L8.745 47.43c-.208.758-1.282.758-1.49 0l-1.27-4.933c-.106-.345-.41-.614-.798-.71l-4.62-1.043c-.757-.208-.757-1.282 0-1.49l4.62-1.044c.388-.094.69-.364.798-.71l1.27-4.932c.207-.757 1.282-.757 1.49 0l1.27 4.933c.106.348.41.617.798.71')
- i++
svg(id="star-" + i, xmlns='http://www.w3.org/2000/svg', viewbox='0 0 64 48')
path.dark-star(d='M40 3.106l2.31.522c.378.104.378.64 0 .745L40 4.895c-.194.048-.346.182-.4.355l-.634 2.466c-.104.38-.64.38-.745 0l-.633-2.466c-.053-.173-.205-.308-.4-.355l-2.31-.522c-.377-.104-.377-.64 0-.745l2.31-.522c.195-.048.347-.182.4-.355L38.22.286c.105-.378.642-.378.746 0L39.6 2.75c.054.174.206.31.4.356')
- i++
svg(id="star-" + i, xmlns='http://www.w3.org/2000/svg', viewbox='0 0 64 48')
path.light-star(d='M46.407 35.106l2.31.522c.378.104.378.64 0 .745l-2.31.522c-.194.048-.346.182-.4.355l-.634 2.466c-.104.38-.64.38-.745 0l-.635-2.466c-.053-.173-.205-.308-.4-.355l-2.31-.522c-.377-.104-.377-.64 0-.745l2.31-.522c.195-.048.347-.182.4-.355l.635-2.465c.104-.378.64-.378.745 0l.634 2.467c.054.174.206.31.4.356')
- i++
svg(id="star-" + i, xmlns='http://www.w3.org/2000/svg', viewbox='0 0 64 48')
path.dark-star(d='M35.703 43.553l1.155.26c.19.053.19.322 0 .374l-1.155.26c-.097.024-.173.092-.2.178l-.317 1.233c-.052.19-.32.19-.373 0l-.317-1.233c-.027-.086-.102-.154-.2-.177l-1.154-.26c-.19-.053-.19-.322 0-.374l1.154-.26c.097-.025.173-.092.2-.178l.317-1.234c.052-.19.32-.19.373 0l.317 1.234c.027.086.103.153.2.177m-17-38l1.155.26c.19.053.19.322 0 .374l-1.155.26c-.097.024-.173.092-.2.178l-.317 1.233c-.052.19-.32.19-.373 0l-.317-1.233c-.027-.086-.102-.154-.2-.177l-1.154-.26c-.19-.053-.19-.322 0-.374l1.154-.26c.097-.025.173-.092.2-.178l.317-1.234c.052-.19.32-.19.373 0l.317 1.234c.027.086.103.153.2.177M11 17c0 1.105-.895 2-2 2s-2-.895-2-2 .895-2 2-2 2 .895 2 2m20 5.5c-4.132 0-7.365-1.472-10.242-3.063l.484-.875C24.002 20.088 27.094 21.5 31 21.5c3.888 0 5.75-.935 5.77-.944l.462.887C37.15 21.486 35.165 22.5 31 22.5m-7.807 10.96l-.386-.922c2.752-1.15 8.58-.832 10.402.007l-.42.91c-1.636-.755-7.1-1.04-9.598.006m8.31-5.335c-1.91 0-3.983-.49-5.783-1.712-.926-.627-1.764-1.305-2.574-1.962-1.372-1.11-2.668-2.16-4.37-3l.444-.897c1.803.892 3.202 2.026 4.556 3.122.794.643 1.615 1.31 2.504 1.913 2.784 1.89 6.292 1.837 8.536.948l2.174-.863.368.93-2.174.863c-1.037.41-2.317.66-3.68.66')
path.light-star(d='M28 15c-5.523 0-10 4.477-10 10s4.477 10 10 10 10-4.477 10-10-4.477-10-10-10m0 1c4.963 0 9 4.037 9 9s-4.037 9-9 9-9-4.037-9-9 4.037-9 9-9')
- }
$light-blue : #3e4150;
$dark-blue : #ddd;
$beige : #ffedaa;
$pink : #E47267;
$dark-star: darken($light-blue, 15%);
$light-star: darken($beige, 15%);
@keyframes rotate {
0% {
transform: rotate(-10deg);
} 100% {
transform: rotate(10deg);
fill: darken($pink, 7%)
}
}
@keyframes scale {
0% {
transform: translate(0, -10px);
fill: lighten($pink, 10%);
} 50% {
transform: translate(0, 4px);
fill: $pink;
} 75% {
transform: translate(0, -4px);
fill: darken($pink, 10%);
} 100% {
transform: translate(0, 2px);
fill: $pink;
}
}
@keyframes float {
0% {
transform: translate(0, 0) rotate(-7deg);
} 100% {
transform: translate(20vw, -10px) rotate(7deg);
}
}
@keyframes background-move {
0% {
transform: translate(0, 0);
} 100% {
transform: translate(0, 160vh);
opacity: 0.25;
}
}
body {
margin : 0;
background-color : $light-blue;
position : relative;
overflow : hidden;
}
#Rocket {
height : 30rem;
position : absolute;
margin: 25vh 15vw;
display : block;
transform-origin: top;
animation: float 4s infinite alternate ease-in-out;
z-index: 100;
#Flame {
fill : $pink;
transform-origin: top;
animation: rotate 4s infinite alternate ease-in-out;
}
.flame-2 {
animation: scale 3s infinite alternate ease-in-out;
}
.flame-3 {
animation: scale 3s infinite alternate-reverse ease-in-out;
}
.light {
fill : $beige;
}
.dark {
fill : $dark-blue;
}
}
.light-star {
fill: $light-star;
}
.dark-star {
fill: $dark-star;
}
svg[id^="star-"] {
position: absolute;
display: block;
height: 5rem;
transform-origin: top;
animation: background-move 10s infinite normal linear;
}
@for $i from 1 through 50 {
#star-#{$i} {
top: - random(150) - 10 + vh;
left: random(100) + vw;
animation-delay: random(6) + s;
}
}
Also see: Tab Triggers