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.
svg.svg-icon__sprite
defs
symbol#dot(viewbox='0 0 32 32')
title Dit icon.
desc For interactions.
circle(cx='16' cy='16' r='14' fill='none' stroke-width='3')
circle(cx='16' cy='16' r='4' fill='none' stroke-width='3')
symbol#arrow(viewbox='0 0 32 32')
title Arrow icon.
desc For interactions.
path(d='M12.8 3c.4 0 .8.2 1.1.5s.5.7.5 1.1c0 .5-.2.8-.5 1.1l-8.5 8.5h24.9c.4 0 .8.2 1.1.5.3.3.5.7.5 1.1s-.2.8-.5 1.1c-.3.3-.7.5-1.1.5H5.5l8.5 8.5c.3.3.5.7.5 1.1 0 .4-.2.8-.5 1.1s-.7.5-1.1.5c-.4 0-.8-.2-1.1-.5L.5 17c-.3-.3-.5-.7-.5-1.1s.2-.8.5-1.1L11.7 3.5c.3-.3.7-.5 1.1-.5z')
symbol#eye(viewbox='0 0 32 32')
title Eye icon.
desc For toggleable elements.
path(d='M16 4c1.5 0 2.9.2 4.2.7 1.4.4 2.6 1 3.6 1.7s2 1.5 2.9 2.3 1.7 1.7 2.3 2.6 1.2 1.6 1.6 2.3c.5.7.8 1.3 1 1.7l.4.7c0 .1-.1.2-.2.4s-.3.5-.6 1.1-.6 1.1-1 1.6-.8 1.2-1.4 1.9c-.6.7-1.2 1.4-1.8 2s-1.3 1.2-2.2 1.9c-.8.6-1.7 1.2-2.6 1.6s-1.9.8-3 1.1c-.9.3-2.1.4-3.2.4-1.5 0-2.9-.2-4.2-.7s-2.6-1-3.6-1.7-2-1.5-2.9-2.3-1.7-1.7-2.3-2.5-1.2-1.6-1.6-2.3-.8-1.3-1-1.7l-.4-.7c0-.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H22S22.7 6 15.7 6c-6.6.2-11.3 4-14 7.9z')
symbol#explorer(viewbox='0 0 32 32')
title iExplorer icon.
desc Support for this browser.
path(d='M23.8 17.5H31c.1-.5.1-1 .1-1.5 0-2.5-.7-4.8-1.8-6.8 1.2-3.2 1.1-5.9-.4-7.5-1.5-1.5-5.6-1.3-10.2.8h-1C11.3 2.5 6 6.9 4.6 12.7c2-2.5 4.1-4.4 6.9-5.7-.3.2-1.7 1.7-2 2-7.3 7.3-9.7 16.9-7.2 19.4 1.9 1.9 5.3 1.6 9.3-.4 1.8.9 3.9 1.5 6.1 1.5 5.9 0 10.9-3.8 12.8-9.1h-7.3c-1 1.9-3 3.1-5.2 3.1s-4.2-1.3-5.2-3.1c-.4-.8-.7-1.8-.7-2.8l11.7-.1zM12 14c.2-3 2.6-5.4 5.7-5.4s5.5 2.4 5.7 5.4H12zM28.8 3.3c1 1 1 3 .1 5.3-1.5-2.3-3.7-4.1-6.3-5.1 2.8-1.2 5.1-1.4 6.2-.2zM4.2 27.9c-1.3-1.3-.9-4.1.8-7.4 1.1 3 3.1 5.4 5.7 7-2.9 1.4-5.3 1.6-6.5.4z')
symbol#checkmark(viewbox='0 0 32 32')
path(d='M2 20 L12 28 30 4')
main.flexy__item.flexy--items-center.flexy--justify-center.flexy--column
article.space--huge
header.space--big.flexy__item.flexy--column.flexy--items-center
h2 Progress ball
p A chaining-animations exercise.
#preloader--progress.preloader.preloader--progress.space--medium
#preloader--progress__ball.preloader__ball
.ball
#preloader--progress__status.preloader--progress__status
svg.preloader--progress__status--item.svg-icon.stroke--white(fill='none')
use.use(xmlns:xlink='http://www.w3.org/1999/xlink' xlink:href='#checkmark')
button#preloader--progress--btn Fire animation
header.header
h1
a(href='http://tadaima.studio' title='Go to Tadaima')
svg.logo-tadaima.fill--white(xmlns='http://www.w3.org/2000/svg' xml:space='preserve' viewBox='0 0 80 80')
title Tadaima Studio.
desc A group of digital interface crafters.
g
rect.st5(y='0', width='80', height='80')
lineargradient#SVGID_1_(gradientunits='userSpaceOnUse', x1='27.7468', y1='18.248', x2='52.244', y2='42.7452')
stop(offset='0', style='stop-color:#FF5572')
stop(offset='1', style='stop-color:#FF7555')
polyline.logo-tadaima--animated(style='fill:none;stroke:url(#SVGID_1_);stroke-width:2;stroke-miterlimit:10;', points='52,27 25,27 25,23 55,23 55,31 40,31 40,54 ')
lineargradient#SVGID_2_(gradientunits='userSpaceOnUse', x1='23.9948', y1='30.0043', x2='48.4901', y2='54.4996')
stop(offset='0', style='stop-color:#FF5572')
stop(offset='1', style='stop-color:#FF7555')
polyline.logo-tadaima--animated(style='fill:none;stroke:url(#SVGID_2_);stroke-width:2;stroke-miterlimit:10;', points='24,31 36,31 36,57 44,57 44,34 ')
svg.svg-bg(xmlns='http://www.w3.org/2000/svg')
defs
circle#a(cx='1468', cy='133', r='35')
mask#h(x='0', y='0', width='70', height='70', fill='#fff')
use(xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#a')
circle#b(cx='236.5', cy='732.5', r='23.5')
mask#i(x='0', y='0', width='47', height='47', fill='#fff')
use(xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#b')
circle#c(cx='1120.5', cy='945.5', r='28.5')
mask#j(x='0', y='0', width='57', height='57', fill='#fff')
use(xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#c')
path#d(d='M1193.375 302.875l44.6 77.25h-89.2z')
mask#k(x='0', y='0', width='89.201', height='77.25', fill='#fff')
use(xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#d')
path#e(d='M1610.8 513.3l34.14 59.128h-68.278z')
mask#l(x='0', y='0', width='68.277', height='59.13', fill='#fff')
use(xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#e')
path#f(d='M51.045 967.864l38.314 66.362H12.73z')
mask#m(x='0', y='0', width='76.629', height='66.362', fill='#fff')
use(xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#f')
path#g(d='M46.045 311.097l26.5 45.897H19.546z')
mask#n(x='0', y='0', width='52.997', height='45.897', fill='#fff')
use(xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#g')
g(style='mix-blend-mode:overlay', fill='none', fill-rule='evenodd', opacity='.35', stroke='#FFF')
use.svg-bg_element(mask='url(#h)', stroke-width='6', xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#a')
use.svg-bg_element(mask='url(#i)', stroke-width='6', xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#b')
use.svg-bg_element.opacity-anim(mask='url(#j)', stroke-width='6', xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#c')
path.stroke-anim(d='M657.5 848.5l46 46', stroke-width='3', stroke-linecap='square')
path(d='M1360.5 1206.5l89-89M761.5 42.5l42-42', stroke-width='3', stroke-linecap='square')
use.svg-bg_element(mask='url(#k)', stroke-width='6', transform='rotate(90 1193.375 341.5)', xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#d')
use.svg-bg_element(mask='url(#l)', stroke-width='6', transform='rotate(45 1610.8 542.863)', xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#e')
use.svg-bg_element.rotate-anim(mask='url(#m)', stroke-width='6', transform='rotate(45 51.045 1001.045)', xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#f')
use.svg-bg_element(mask='url(#n)', stroke-width='6', transform='rotate(20 46.045 334.045)', xmlns:xlink='http://www.w3.org/1999/xlink', xlink:href='#g')
$bezier: cubic-bezier(0.54,-0.24, 0.46, 1.28);
$easeIn: cubic-bezier(0.76,-0.01, 1, 1);
$easeOut: cubic-bezier(0, 0, 0.15, 1.01);
$ballSize: 1em;
$bounceTrack: $ballSize * 5;
$slowDuration: .9s;
article {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column
}
button {
border: 0;
border-radius: 0;
display: flex;
justify-content: center;
font-size: 1em;
align-items: center;
padding: 1em 1.5em;
height: 1em;
line-height: 1.2em;
box-sizing: content-box;
color: white;
background-color: transparent;
text-transform: uppercase;
border: 1px solid white;
font-family: inherit;
transition: all ($slowDuration / 1.5) ease-in-out;
&.active {
color: red;
background-color: white;
pointer-events: none;
opacity: .2;
}
}
.preloader {
font-size: 2em;
$thisDuration: $slowDuration;
&__ball {
display: flex;
position: relative;
width: $ballSize;
&:after,
.ball {
content: '';
display: flex;
border-radius: 50%;
width: $ballSize;
height: $ballSize;
}
.ball {
background-color: white;
}
&:after {
position: absolute;
z-index: -1;
background-color: black;
bottom: 0;
left: 50%;
opacity: .25;
transform: translate(-50%, ($ballSize / 2)) rotateX(70deg) scale(1);
}
}
&--bounce {
.preloader__ball {
height: $bounceTrack;
.ball {
transform-origin: 50% 100%;
// transform: translate(0, ($bounceTrack - $ballSize)) scaleY(1) scaleX(1);
animation: bounceBall $thisDuration $easeOut infinite;
}
&:after {
opacity: .25;
transform: translate(-50%, ($ballSize / 2)) rotateX(70deg) scale(.9);
animation: bounceBallShadow $thisDuration linear infinite;
}
&.end {
&:after {
animation: none;
opacity: 0;
}
.ball {
animation: bounceBallExplode $thisDuration linear forwards;
}
}
}
}
&--pendulum {
$thisDuration: $thisDuration * 2;
$bounceTrack: $ballSize * 2;
display: flex;
align-items: center;
.preloader__ball {
height: $bounceTrack;
&:last-child,
&:first-child {
&:after,
.ball{
animation: $thisDuration $easeOut infinite;
}
.ball{
transform-origin: 50% (-$bounceTrack);
}
}
&:first-child {
.ball {
animation-name: pendulumBallLeft;
}
&:after {
animation-name: pendulumBallLeftShadow;
}
}
&:last-child {
.ball {
animation-name: pendulumBallRight;
}
&:after {
animation-name: pendulumBallRightShadow;
}
}
}
}
&--progress {
$loadingColor: #BF3E47;
position: relative;
height: $ballSize / 5;
width: 0;
border-radius: $ballSize / 5;
transition: width ($thisDuration / 3) cubic-bezier(0.79,-0.33, 0.21, 1.37);
background-color: white;
box-shadow: 0 ($ballSize - .05em) 0 -.05em #bf4c4a;
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
background-image: linear-gradient($loadingColor 0, $loadingColor 100%);
background-repeat: no-repeat;
background-size: 0 100%;
width: 100%;
height: 100%;
border-radius: $ballSize / 5;
transition: background $thisDuration $easeOut;
transition-delay: ($thisDuration * 18) / 100;
}
.preloader__ball {
position: absolute;
left: 0;
top: 50%;
transform: translate(-50%, calc(-50% - #{$ballSize / 20}));
.ball {
background-color: white;
// background-color: $loadingColor;
transform: scale(0);
}
&:after {
opacity: 1;
background-color: #bf4c4a;
transform: translate(-50%, $ballSize) rotateX(70deg) scale(0);
}
&.active {
animation: preloaderProgressBallMove $thisDuration $easeOut forwards;
.ball {
animation: preloaderProgressBall $thisDuration linear forwards;
}
&:after {
animation: preloaderProgressBallShadow $thisDuration linear forwards;
}
}
&.explode {
left: 100%;
&:after {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(1);
animation: preloaderProgressBallShadowExplode $thisDuration linear forwards;
animation-delay: ($thisDuration / 3);
}
.ball {
transform: scale(1);
animation: preloaderProgressBallExplode $thisDuration linear forwards;
animation-delay: ($thisDuration / 3);
}
}
}
&.active {
width: $bounceTrack * 1.5;
}
&.loading:before {
background-size: 100% 100%;
}
&__status {
position: absolute;
min-width: 1em;
min-height: 1em;
width: 100%;
height: 100%;
left: 50%;
transform: translate(-50%, calc(-50% - #{$ballSize / 20}));
transition: all ($thisDuration * 1.25) ease-in-out;
opacity: 0;
&--item {
transition: all ($thisDuration * 1.25) ease-in-out;
}
&.active {
animation: statusJump ($thisDuration / 2.5) $easeOut ($thisDuration / 2.5) forwards;
.preloader--progress__status--item {
stroke-width: .1em;
transform: rotateY(360deg);
}
}
&.hide .preloader--progress__status--item {
opacity: 0;
}
}
}
}
@keyframes bounceBallShadow {
50% {
opacity: .1;
transform: translate(-50%, ($ballSize / 2)) rotateX(70deg) scale(.2);
}
}
@keyframes bounceBall {
0%,
100% {
transform: translate(0, ($bounceTrack - $ballSize)) scaleY(1) scaleX(1);
}
50% {
animation-timing-function: $easeIn;
transform: translate(0, 0) scaleY(1) scaleX(1);
}
96% {
animation-timing-function: $easeOut;
transform: translate(0, ($bounceTrack - $ballSize)) scaleY(1) scaleX(1);
}
98% {
animation-timing-function: $easeOut;
transform: translate(0, ($bounceTrack - $ballSize)) scaleY(.8) scaleX(1.2);
}
}
@keyframes bounceBallExplode {
0% {
transform: translate(0, ($bounceTrack - $ballSize)) scale(1);
}
5% {
transform: translate(0, ($bounceTrack - $ballSize)) scale(.8);
opacity: 1;
}
10%,
100% {
transform: translate(0, ($bounceTrack - $ballSize)) scale(2);
opacity: 0;
}
}
@keyframes pendulumBallLeft {
20% {
animation-timing-function: $easeIn;
transform: translate(0, (($ballSize * 2) - ($ballSize * 2))) rotate(90deg);
}
100%,
50% {
transform: translate(0, (($ballSize * 2) - ($ballSize * 2))) rotate(0);
}
}
@keyframes pendulumBallRight {
80% {
animation-timing-function: $easeIn;
transform: translate(0, (($ballSize * 2) - ($ballSize * 2))) rotate(-90deg);
}
100%,
50% {
transform: translate(0, (($ballSize * 2) - ($ballSize * 2))) rotate(0);
}
}
@keyframes pendulumBallLeftShadow {
20% {
animation-timing-function: $easeIn;
opacity: .1;
transform: translate(-($bounceTrack - ($ballSize * 1.5)), ($ballSize / 2)) rotateX(70deg) scale(.4);
}
100%,
50% {
opacity: .25;
transform: translate(-50%, ($ballSize / 2)) rotateX(70deg) scale(1);
}
}
@keyframes pendulumBallRightShadow {
80% {
animation-timing-function: $easeIn;
opacity: .1;
transform: translate(($bounceTrack - ($ballSize * 2.8)), ($ballSize / 2)) rotateX(70deg) scale(.4);
}
100%,
50% {
opacity: .25;
transform: translate(-50%, ($ballSize / 2)) rotateX(70deg) scale(1);
}
}
@keyframes preloaderProgressBall {
5% {
transform: scale(1.2);
}
10% {
transform: scale(1);
}
15% {
transform: scale(1.1);
}
20% {
transform: scale(1);
}
100% {
transform: scale(1);
}
}
@keyframes preloaderProgressBallShadow {
5% {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(1.2);
}
10% {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(1);
}
15% {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(1.1);
}
20% {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(1);
}
100% {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(1);
}
}
@keyframes preloaderProgressBallMove {
20% {
left: 0;
}
100% {
left: 100%;
}
}
@keyframes preloaderProgressBallExplode {
0% {
transform: scale(1);
}
5% {
transform: scale(.8);
opacity: 1;
}
10%,
100% {
transform: scale(2);
opacity: 0;
}
}
@keyframes preloaderProgressBallShadowExplode {
0% {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(1);
}
5% {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(.8);
opacity: 1;
}
10%,
100% {
transform: translate(-50%, $ballSize) rotateX(70deg) scale(2);
opacity: 0;
}
}
@keyframes progressBackground {
100% {
background-color: blue;
}
}
@keyframes statusJump {
0% {
opacity: 0;
transform: translate(-50%, calc((-50% - #{$ballSize / 20})));
}
50% {
opacity: 1;
animation-timing-function: $easeIn;
transform: translate(-50%, calc((-50% - #{$ballSize / 20}) * 3));
}
80% {
animation-timing-function: $easeOut;
transform: translate(-50%, calc((-50% - #{$ballSize / 20})));
}
90% {
animation-timing-function: $easeIn;
transform: translate(-50%, calc((-50% - #{$ballSize / 20}) * 1.5));
}
100% {
opacity: 1;
transform: translate(-50%, calc((-50% - #{$ballSize / 20})));
}
}
var preloaderProgress = $('#preloader--progress'),
preloaderProgressBtn = $('#preloader--progress--btn'),
preloaderProgressStatus = $('#preloader--progress__status'),
preloaderProgressBall = $('#preloader--progress__ball');
function animate() {
preloaderProgress.addClass('active');
preloaderProgress.on('webkitTtransitionEnd otransitionend msTransitionEnd transitionend', function() {
preloaderProgressBall.addClass('active');
preloaderProgress.addClass('loading');
});
preloaderProgressBall.on('webkitAnimationEnd oanimationend msAnimationEnd animationend', function() {
preloaderProgress.removeClass('active');
preloaderProgressBall.removeClass('active');
preloaderProgressBall.addClass('explode');
preloaderProgressStatus.addClass('active');
setTimeout(function() {
preloaderProgress.unbind();
preloaderProgressBall.unbind();
preloaderProgressBall.removeClass('explode');
preloaderProgressBall.removeClass('active');
preloaderProgress.removeClass('loading');
}, 900);
});
preloaderProgressStatus.on('webkitAnimationEnd oanimationend msAnimationEnd animationend', function() {
preloaderProgressStatus.addClass('hide');
setTimeout(function() {
preloaderProgressStatus.removeClass('active hide');
preloaderProgressBtn.removeClass('active');
preloaderProgressStatus.unbind();
}, 3500);
});
}
preloaderProgressBtn.click(function() {
animate();
preloaderProgressBtn.addClass('active');
});
Also see: Tab Triggers