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="contain-demo">
<div class="contain-loader">
<!-- Begin circle loader -->
<svg class="circle-loader" width="150px" height="150px" viewBox="0 0 250 250">
<g class="circle-apple circle-apple-1">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M33.9 111.4c0 0-2-3.7 1.5-8.9"/>
<path fill="#ED6E46" d="M52 128c-1 11-7 20-14 19-1 0-3-1-4-1-1 1-2 1-3 1-7 1-13-7-15-18s2-21 9-22c3 0 6 1 9 4 2-3 5-4 8-4C48 107 53 117 52 128z"/>
</g>
<g class="circle-apple circle-apple-2">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M216.9 111.4c0 0-2-3.7 1.5-8.9"/>
<path fill="#ED6E46" d="M235 128c-1 11-7 20-14 19-1 0-3-1-4-1-1 1-2 1-3 1-7 1-13-7-15-18s2-21 9-22c3 0 6 1 9 4 2-3 5-4 8-4C231 107 236 117 235 128z"/>
</g>
<g class="circle-apple circle-apple-3">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M125.3 22.1c0 0-2-3.7 1.5-8.9"/>
<path fill="#ED6E46" d="M143 39c-1 11-7 20-14 19-1 0-3-1-4-1-1 1-2 1-3 1-7 1-13-7-15-18-2-11 2-21 9-22 3 0 6 1 9 4 2-3 5-4 8-4C140 18 144 28 143 39z"/>
</g>
<g class="circle-apple circle-apple-4">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M125.3 198.2c0 0-2-3.7 1.5-8.9"/>
<path fill="#ED6E46" d="M143 215c-1 11-7 20-14 19-1 0-3-1-4-1-1 1-2 1-3 1-7 1-13-7-15-18-2-11 2-21 9-22 3 0 6 1 9 4 2-3 5-4 8-4C140 194 144 204 143 215z"/>
</g>
<g class="circle-apple circle-apple-5">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M58.2 44.5c0 0-2-3.7 1.5-8.9"/>
<path fill="#ED6E46" d="M76 61c-1 11-7 20-14 19-1 0-3-1-4-1-1 1-2 1-3 1-7 1-13-7-15-18-2-11 2-21 9-22 3 0 6 1 9 4 2-3 5-4 8-4C73 40 77 50 76 61z"/>
</g>
<g class="circle-apple circle-apple-6">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M194.1 46.5c0 0-2-3.7 1.5-8.9"/>
<path fill="#ED6E46" d="M212 63c-1 11-7 20-14 19-1 0-3-1-4-1-1 1-2 1-3 1-7 1-13-7-15-18-2-11 2-21 9-22 3 0 6 1 9 4 2-3 5-4 8-4C209 42 213 52 212 63z"/>
</g>
<g class="circle-apple circle-apple-7">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M57.4 175.8c0 0-2-3.7 1.5-8.9"/>
<path fill="#ED6E46" d="M75 193c-1 11-7 20-14 19-1 0-3-1-4-1-1 1-2 1-3 1-7 1-13-7-15-18-2-11 2-21 9-22 3 0 6 1 9 4 2-3 5-4 8-4C72 172 76 181 75 193z"/>
</g>
<g class="circle-apple circle-apple-8">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M196 171.3c0 0-2-3.7 1.5-8.9"/>
<path fill="#ED6E46" d="M214 188c-1 11-7 20-14 19-1 0-3-1-4-1-1 1-2 1-3 1-7 1-13-7-15-18-2-11 2-21 9-22 3 0 6 1 9 4 2-3 5-4 8-4C210 167 215 177 214 188z"/>
</g>
</svg>
<!-- End circle loader -->
</div>
<div class="contain-loader">
<!-- Begin block loader -->
<svg width="150px" height="150px" viewBox="0 0 250 250">
<g class="block-apple block-apple-1">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M51.2 34.2c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M74 55c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23s3-26 11-28c4-1 8 1 11 5 3-4 7-5 10-5C69 29 75 41 74 55z"/>
</g>
<g class="block-apple block-apple-2">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M124.4 33.6c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M147 55c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23s3-26 11-28c4-1 8 1 11 5 3-4 7-5 10-5C143 28 148 40 147 55z"/>
</g>
<g class="block-apple block-apple-3">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M200 34c0 0-2-5 2-11"/>
<path fill="#ED6E46" d="M223 55c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23-2-14 3-26 11-28 4-1 8 1 11 5 3-4 7-5 10-5C218 29 224 41 223 55z"/>
</g>
<g class="block-apple block-apple-4">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M52.2 108.4c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M75 129c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23s3-26 11-28c4-1 8 1 11 5 3-4 7-5 10-5C70 103 76 115 75 129z"/>
</g>
<g class="block-apple block-apple-5">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M125.4 107.9c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M148 129c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23s3-26 11-28c4-1 8 1 11 5 3-4 7-5 10-5C144 103 149 115 148 129z"/>
</g>
<g class="block-apple block-apple-6">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M201.2 108.5c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M224 129c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23-2-14 3-26 11-28 4-1 8 1 11 5 3-4 7-5 10-5C219 103 225 115 224 129z"/>
</g>
<g class="block-apple block-apple-7">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M50.9 182.1c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M73 203c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23-2-14 3-26 11-28 4-1 8 1 11 5 3-4 7-5 10-5C69 177 75 189 73 203z"/>
</g>
<g class="block-apple block-apple-8">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M124.1 181.6c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M147 202c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23-2-14 3-26 11-28 4-1 8 1 11 5 3-4 7-5 10-5C142 176 148 188 147 202z"/>
</g>
<g class="block-apple block-apple-9">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M199.9 182.1c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M223 203c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23-2-14 3-26 11-28 4-1 8 1 11 5 3-4 7-5 10-5C218 177 224 189 223 203z"/>
</g>
</svg>
<!-- End block loader -->
</div>
<div class="contain-loader contain-path-demo">
<!-- Begin path loader -->
<svg width="250px" height="250px" viewBox="0 0 400 400">
<circle fill="none" stroke="#7AA20D" stroke-width="5" stroke-miterlimit="10" cx="160" cy="250" r="93.033"/>
<g id="path" class="path-apple">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M33.4 110c0 0-2.1-3.8 1.6-9.3"/>
<path fill="#ED6E46" stroke="#ED6E46" stroke-width="1" stroke-linejoin="round" d="M52.8 129c-1.1 11.8-7.7 20.9-14.7 20.3 -1.5-0.1-2.9-0.7-4.1-1.6 -1.1 0.8-2.2 1.2-3.5 1.4 -7 1.1-14.1-7.6-15.9-19.4s2.4-22.2 9.4-23.2c3.3-0.5 6.5 1.1 9.3 4.2 2.5-3 5.6-4.6 8.7-4.3C49.1 107 53.9 117.1 52.8 129z"/>
<animateMotion
xlink:href="#path"
dur="800ms"
repeatCount="indefinite"
path="M218 125c0 51-42 93-93 93S32 176 32 125 74 32 125 32 218 74 218 125z"/>
</g>
</svg>
<!-- End path loader -->
</div>
<div class="contain-loader">
<!-- Begin line loader -->
<svg width="150" height="150" viewBox="0 0 250 250">
<g class="line-1">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M26.5 108c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M49 129c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23s3-26 11-28c4-1 8 1 11 5 3-4 7-5 10-5C45 103 50 115 49 129z"/>
</g>
<g class="line-2">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M159.4 108c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M182 129c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23-2-14 3-26 11-28 4-1 8 1 11 5 3-4 7-5 10-5C178 103 183 115 182 129z"/>
</g>
<g class="line-3">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M224.3 108c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M247 129c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23-2-14 3-26 11-28 4-1 8 1 11 5 3-4 7-5 10-5C242 103 248 115 247 129z"/>
</g>
<g class="line-4">
<path fill="none" stroke="#59351C" stroke-width="2" stroke-linecap="round" d="M91.5 108c0 0-2.5-4.6 1.9-11.1"/>
<path fill="#ED6E46" d="M114 129c-1 14-9 25-18 24-2 0-3-1-5-2-1 1-3 2-4 2-8 1-17-9-19-23-2-14 3-26 11-28 4-1 8 1 11 5 3-4 7-5 10-5C110 103 115 115 114 129z"/>
</g>
</svg>
<!-- End line loader -->
</div>
</div>
@import "compass/css3";
$background: #f2e2d1;
$circle-timing: 1800ms;
$block-timing: 1500ms;
$jump-timing: 700ms;
$repeat-count: infinite;
// General styling
body {
background: $background;
}
.contain-demo {
margin-top: 70px;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
// Circle loader
.circle-apple {
transform-origin: center;
}
.circle-apple-1 {
animation: smaller $circle-timing $repeat-count;
}
.circle-apple-5 {
animation: smaller $circle-timing 200ms $repeat-count;
}
.circle-apple-3 {
animation: smaller $circle-timing 600ms $repeat-count;
}
.circle-apple-6 {
animation: smaller $circle-timing 800ms $repeat-count;
}
.circle-apple-2 {
animation: smaller $circle-timing 1000ms $repeat-count;
}
.circle-apple-8 {
animation: smaller $circle-timing 1200ms $repeat-count;
}
.circle-apple-4 {
animation: smaller $circle-timing 1400ms $repeat-count;
}
.circle-apple-7 {
animation: smaller $circle-timing 1500ms $repeat-count;
}
@keyframes smaller {
5% {
transform: scale(.3);
}
}
// Block loader
.block-apple {
opacity: 0;
}
.block-apple-1 {
animation: appear $block-timing $repeat-count;
}
.block-apple-6 {
animation: appear $block-timing 50ms $repeat-count;
}
.block-apple-8 {
animation: appear $block-timing 100ms $repeat-count;
}
.block-apple-3 {
animation: appear $block-timing 150ms $repeat-count;
}
.block-apple-7 {
animation: appear $block-timing 200ms $repeat-count;
}
.block-apple-4 {
animation: appear $block-timing 250ms $repeat-count;
}
.block-apple-9 {
animation: appear $block-timing 300ms $repeat-count;
}
.block-apple-2 {
animation: appear $block-timing 350ms $repeat-count;
}
.block-apple-5 {
animation: appear $block-timing 450ms $repeat-count;
}
@keyframes appear {
42% {
opacity: 0;
}
43% {
opacity: 1;
}
99% {
opacity: 1;
}
}
.contain-path-demo {
margin-top: -80px;
}
// Line loader
.line-1 {
animation: jump $jump-timing $repeat-count;
}
.line-4 {
animation: jump $jump-timing 100ms $repeat-count;
}
.line-2 {
animation: jump $jump-timing 200ms $repeat-count;
}
.line-3 {
animation: jump $jump-timing 300ms $repeat-count;
}
@keyframes jump {
30% {
transform: translateY(-20px) rotateX(60deg);
}
60% {
transform: translateY(0);
}
90% {
transform: translateY(0);
}
}
/* Just some weird musings for An Apple A Day Project:
https://jonitrythall.github.io/appleproject/
Tested in Chrome only */
Also see: Tab Triggers