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 id="loader">
<div class="box">
<hr>
<h1>Some loaders with zoom and gradient color animations</h1>
<hr>
<div class="circle">
<div class="ribble">
<h2>Fast</h2>
<div class="blobb-gradient circle fast"></div>
<div class="blobb-gradient circle fast"></div>
<div class="blobb-gradient circle fast"></div>
<div class="blobb-gradient circle fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="blobb-gradient circle slow"></div>
<div class="blobb-gradient circle slow"></div>
<div class="blobb-gradient circle slow"></div>
<div class="blobb-gradient circle slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="blobb-gradient circle slowest"></div>
<div class="blobb-gradient circle slowest"></div>
<div class="blobb-gradient circle slowest"></div>
<div class="blobb-gradient circle slowest"></div>
</div>
</div>
<div class="square">
<div class="ribble">
<h2>Fast</h2>
<div class="blobb-gradient square fast"></div>
<div class="blobb-gradient square fast"></div>
<div class="blobb-gradient square fast"></div>
<div class="blobb-gradient square fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="blobb-gradient square slow"></div>
<div class="blobb-gradient square slow"></div>
<div class="blobb-gradient square slow"></div>
<div class="blobb-gradient square slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="blobb-gradient square slowest"></div>
<div class="blobb-gradient square slowest"></div>
<div class="blobb-gradient square slowest"></div>
<div class="blobb-gradient square slowest"></div>
</div>
</div>
</div>
<div class="box">
<hr>
<h1>Some Loaders with zoom and color animations</h1>
<hr>
<div class="circle">
<div class="ribble">
<h2>Fast</h2>
<div class="blobb circle fast"></div>
<div class="blobb circle fast"></div>
<div class="blobb circle fast"></div>
<div class="blobb circle fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="blobb circle slow"></div>
<div class="blobb circle slow"></div>
<div class="blobb circle slow"></div>
<div class="blobb circle slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="blobb circle slowest"></div>
<div class="blobb circle slowest"></div>
<div class="blobb circle slowest"></div>
<div class="blobb circle slowest"></div>
</div>
</div>
<div class="square">
<div class="ribble">
<h2>Fast</h2>
<div class="blobb square fast"></div>
<div class="blobb square fast"></div>
<div class="blobb square fast"></div>
<div class="blobb square fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="blobb square slow"></div>
<div class="blobb square slow"></div>
<div class="blobb square slow"></div>
<div class="blobb square slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="blobb square slowest"></div>
<div class="blobb square slowest"></div>
<div class="blobb square slowest"></div>
<div class="blobb square slowest"></div>
</div>
</div>
</div>
<div class="box">
<hr>
<h1>Some loaders without zoom and color fading</h1>
<hr>
<div class="square">
<div class="ribble">
<h2>Fast</h2>
<div class="fade square fast"></div>
<div class="fade square fast"></div>
<div class="fade square fast"></div>
<div class="fade square fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="fade square slow"></div>
<div class="fade square slow"></div>
<div class="fade square slow"></div>
<div class="fade square slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="fade square slowest"></div>
<div class="fade square slowest"></div>
<div class="fade square slowest"></div>
<div class="fade square slowest"></div>
</div>
</div>
<div class="square">
<div class="ribble">
<h2>Fast</h2>
<div class="fade square nm fast"></div>
<div class="fade square nm fast"></div>
<div class="fade square nm fast"></div>
<div class="fade square nm fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="fade square nm slow"></div>
<div class="fade square nm slow"></div>
<div class="fade square nm slow"></div>
<div class="fade square nm slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="fade square nm slowest"></div>
<div class="fade square nm slowest"></div>
<div class="fade square nm slowest"></div>
<div class="fade square nm slowest"></div>
</div>
</div>
<div class="circle">
<div class="ribble">
<h2>Fast</h2>
<div class="fade circle fast"></div>
<div class="fade circle fast"></div>
<div class="fade circle fast"></div>
<div class="fade circle fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="fade circle slow"></div>
<div class="fade circle slow"></div>
<div class="fade circle slow"></div>
<div class="fade circle slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="fade circle slowest"></div>
<div class="fade circle slowest"></div>
<div class="fade circle slowest"></div>
<div class="fade circle slowest"></div>
</div>
</div>
</div>
<div class="box">
<hr>
<h1>Some loaders without zoom and gradient color fading</h1>
<hr>
<div class="square">
<div class="ribble">
<h2>Fast</h2>
<div class="fade-gradient square fast"></div>
<div class="fade-gradient square fast"></div>
<div class="fade-gradient square fast"></div>
<div class="fade-gradient square fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="fade-gradient square slow"></div>
<div class="fade-gradient square slow"></div>
<div class="fade-gradient square slow"></div>
<div class="fade-gradient square slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="fade-gradient square slowest"></div>
<div class="fade-gradient square slowest"></div>
<div class="fade-gradient square slowest"></div>
<div class="fade-gradient square slowest"></div>
</div>
</div>
<div class="square">
<div class="ribble">
<h2>Fast</h2>
<div class="fade-gradient square nm fast"></div>
<div class="fade-gradient square nm fast"></div>
<div class="fade-gradient square nm fast"></div>
<div class="fade-gradient square nm fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="fade-gradient square nm slow"></div>
<div class="fade-gradient square nm slow"></div>
<div class="fade-gradient square nm slow"></div>
<div class="fade-gradient square nm slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="fade-gradient square nm slowest"></div>
<div class="fade-gradient square nm slowest"></div>
<div class="fade-gradient square nm slowest"></div>
<div class="fade-gradient square nm slowest"></div>
</div>
</div>
<div class="circle">
<div class="ribble">
<h2>Fast</h2>
<div class="fade-gradient circle fast"></div>
<div class="fade-gradient circle fast"></div>
<div class="fade-gradient circle fast"></div>
<div class="fade-gradient circle fast"></div>
</div>
<div class="ribble">
<h2>Slow</h2>
<div class="fade-gradient circle slow"></div>
<div class="fade-gradient circle slow"></div>
<div class="fade-gradient circle slow"></div>
<div class="fade-gradient circle slow"></div>
</div>
<div class="ribble">
<h2>Slowest</h2>
<div class="fade-gradient circle slowest"></div>
<div class="fade-gradient circle slowest"></div>
<div class="fade-gradient circle slowest"></div>
<div class="fade-gradient circle slowest"></div>
</div>
</div>
</div>
</div>
/* Loader Size */
$loader-width: 20px;
$loader-height: 20px;
/* Animation durations */
$fast-animation: 1.25s;
$slow-animation: 1.55s;
$slowest-animation: 2s;
/* Animation delay */
$animation-delay: 0.25s;
/* Animation Color and Zoom */
// First blobb
$blobb-first-color: rgb(45, 125, 154);
$blobb-second-color: rgb(0, 153, 188);
// Second blobb
$blobb-third-color: rgb(22, 160, 133);
$blobb-fourth-color: rgb(46, 204, 113);
// Fade without zoom
$fade-from-color: rgb(45, 125, 154);
$fade-to-color: rgb(0, 172, 211);
// Fade without zoom gradient
$fade-gradient-from-color: rgb(22, 160, 133);
$fade-gradient-to-color: rgb(46, 204, 113);
$zoom-size: 1.2;
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-family: sans-serif;
font-size: 100%;
color: rgb(100, 100, 100);
padding: 0;
}
h1 {
font-size: 20px;
}
h2 {
font-size: 17px;
}
body {
background: #eee;
}
footer {
#wrapper {
width: 768px;
height: 50px;
text-align: center;
margin: auto;
background: #fff;
}
a {
line-height: 50px;
}
}
.box {
padding-top: 25px;
padding: 25px;
margin-bottom: 25px;
max-width: 768px;
margin: 25px auto;
background: #fff;
}
#loader {
.ribble {
display: inline-block;
min-width: 33.33333%;
margin-right: -3px;
min-height: 100px;
&:not(:first-child) {
}
.blobb {
width: $loader-width;
display: inline-block;
height: $loader-height;
margin-right: 1.5px;
background-color: $blobb-first-color;
-webkit-transition: 1s all ease-in-out;
transition: 1s all ease-in-out;
&.circle {
border-radius: 50%;
}
&.square {
border-radius: 0%;
}
&.fast {
-webkit-animation: blobb $fast-animation infinite;
animation: blobb $fast-animation infinite;
}
&.slow {
-webkit-animation: blobb $slow-animation infinite;
animation: blobb $slow-animation infinite;
}
&.slowest {
-webkit-animation: blobb $slowest-animation infinite;
animation: blobb $slowest-animation infinite;
}
&:nth-child(2) {
-webkit-animation-delay: $animation-delay;
animation-delay: $animation-delay;
}
&:nth-child(3) {
-webkit-animation-delay: $animation-delay*2;
animation-delay: $animation-delay*2;
}
&:nth-child(4) {
-webkit-animation-delay: $animation-delay*3;
animation-delay: $animation-delay*3;
}
&:nth-child(5) {
-webkit-animation-delay: $animation-delay*4;
animation-delay: $animation-delay*4;
}
}
.blobb-gradient {
width: $loader-width;
display: inline-block;
height: $loader-height;
margin-right: 1.5px;
background-color: $blobb-third-color;
-webkit-transition: 1s all ease-in-out;
transition: 1s all ease-in-out;
&.circle {
border-radius: 50%;
}
&.square {
border-radius: 0%;
}
&.fast {
-webkit-animation: blobb-gradient $fast-animation infinite;
animation: blobb-gradient $fast-animation infinite;
}
&.slow {
-webkit-animation: blobb-gradient $slow-animation infinite;
animation: blobb-gradient $slow-animation infinite;
}
&.slowest {
-webkit-animation: blobb-gradient $slowest-animation infinite;
animation: blobb-gradient $slowest-animation infinite;
}
&:nth-child(2) {
-webkit-animation-delay: $animation-delay;
animation-delay: $animation-delay;
}
&:nth-child(3) {
-webkit-animation-delay: $animation-delay*2;
animation-delay: $animation-delay*2;
}
&:nth-child(4) {
-webkit-animation-delay: $animation-delay*3;
animation-delay: $animation-delay*3;
}
&:nth-child(5) {
-webkit-animation-delay: $animation-delay*4;
animation-delay: $animation-delay*4;
}
}
.fade {
width: $loader-width;
display: inline-block;
height: $loader-height;
margin-right: 1.5px;
background-color: $fade-from-color;
-webkit-transition: 1s all ease-in-out;
transition: 1s all ease-in-out;
&.nm {
float: left;
margin: 0;
}
&.circle {
border-radius: 50%;
}
&.square {
border-radius: 0%;
}
&.fast {
-webkit-animation: fade $fast-animation infinite;
animation: fade $fast-animation infinite;
}
&.slow {
-webkit-animation: fade $slow-animation infinite;
animation: fade $slow-animation infinite;
}
&.slowest {
-webkit-animation: fade $slowest-animation infinite;
animation: fade $slowest-animation infinite;
}
&:nth-child(2) {
-webkit-animation-delay: $animation-delay;
animation-delay: $animation-delay;
}
&:nth-child(3) {
-webkit-animation-delay: $animation-delay*2;
animation-delay: $animation-delay*2;
}
&:nth-child(4) {
-webkit-animation-delay: $animation-delay*3;
animation-delay: $animation-delay*3;
}
&:nth-child(5) {
-webkit-animation-delay: $animation-delay*4;
animation-delay: $animation-delay*4;
}
}
.fade-gradient {
width: $loader-width;
display: inline-block;
height: $loader-height;
margin-right: 1.5px;
background-color: $fade-gradient-from-color;
-webkit-transition: 1s all ease-in-out;
transition: 1s all ease-in-out;
&.nm {
float: left;
margin: 0;
}
&.circle {
border-radius: 50%;
}
&.square {
border-radius: 0%;
}
&.fast {
-webkit-animation: fade-gradient $fast-animation infinite;
animation: fade-gradient $fast-animation infinite;
}
&.slow {
-webkit-animation: fade-gradient $slow-animation infinite;
animation: fade-gradient $slow-animation infinite;
}
&.slowest {
-webkit-animation: fade-gradient $slowest-animation infinite;
animation: fade-gradient $slowest-animation infinite;
}
&:nth-child(2) {
-webkit-animation-delay: $animation-delay;
animation-delay: $animation-delay;
}
&:nth-child(3) {
-webkit-animation-delay: $animation-delay*2;
animation-delay: $animation-delay*2;
}
&:nth-child(4) {
-webkit-animation-delay: $animation-delay*3;
animation-delay: $animation-delay*3;
}
&:nth-child(5) {
-webkit-animation-delay: $animation-delay*4;
animation-delay: $animation-delay*4;
}
}
}
}
/* Animation */
@-webkit-keyframes blobb {
0%,
25% {
background: $blobb-first-color;
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
background-color: $blobb-second-color;
-webkit-transform: scale($zoom-size);
transform: scale($zoom-size);
}
100% {
background-color: $blobb-first-color;
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes blobb {
0%,
25% {
background: $blobb-first-color;
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
background-color: $blobb-second-color;
-webkit-transform: scale($zoom-size);
transform: scale($zoom-size);
}
100% {
background-color: $blobb-first-color;
-webkit-transform: scale(1);
transform: scale(1);
}
}
@-webkit-keyframes blobb-gradient {
0%,
25% {
background: $blobb-third-color;
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
background-color: $blobb-fourth-color;
-webkit-transform: scale($zoom-size);
transform: scale($zoom-size);
}
100% {
background-color: $blobb-third-color;
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes blobb-gradient {
0%,
25% {
background: $blobb-third-color;
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
background-color: $blobb-fourth-color;
-webkit-transform: scale($zoom-size);
transform: scale($zoom-size);
}
100% {
background-color: $blobb-third-color;
-webkit-transform: scale(1);
transform: scale(1);
}
}
@-webkit-keyframes fade {
0%,
5% {
background: $fade-from-color;
}
50% {
background-color: $fade-to-color;
}
100% {
background-color: $fade-from-color;
}
}
@keyframes fade {
0%,
5% {
background: $fade-from-color;
}
50% {
background-color: $fade-to-color;
}
100% {
background-color: $fade-from-color;
}
}
@-webkit-keyframes fade-gradient {
0%,
5% {
background: $fade-gradient-from-color;
}
50% {
background-color: $fade-gradient-to-color;
}
100% {
background-color: $fade-gradient-from-color;
}
}
@keyframes fade-gradient {
0%,
5% {
background: $fade-gradient-from-color;
}
50% {
background-color: $fade-gradient-to-color;
}
100% {
background-color: $fade-gradient-from-color;
}
}
Also see: Tab Triggers