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.
<header>
<h1>Pure <strong>CSS</strong> Loader</h1>
<p>... a Sassy SVG snippet.</p>
</header>
<section>
<header aria-hidden="true">
<h2>Enjoy this <strong>tasty snippet,</strong> it works without any JavaScript code and is "ready-to-use".</h2>
</header>
<div class="header">
<div class="chart-container">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12.5em" height="12.5em" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve" class="svg-loader">
<defs>
<filter id="glow" x="-120%" y="-120%" width="400%" height="400%">
<feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"></feOffset>
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="10"></feGaussianBlur>
<feBlend in="SourceGraphic" in2="blurOut" mode="overlay"></feBlend>
</filter>
</defs>
<g transform = "rotate(-89 100 100)">
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="svg-loader_glow white" filter="url(#glow)"/>
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="svg-loader_grow svg-loader_animate red hair-line" role="progressbar" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"/>
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="svg-loader_grow svg-loader_animate lime" role="progressbar" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100" transform = "scale(.8, .8) translate(25 25)"/>
</g>
</svg>
</div>
</div>
<article>
<input type="checkbox" name="valuenow-90" id="valuenow-90" class="valuenow-90" value="">
<div class="info">
<div>
<header>
<h3>It's Easy.</h3>
</header>
<p>This loader is really easy to use, just change the <code>aria-valuenow</code> attribute to see it in action.</p>
</div>
<label for="valuenow-90">Change valuenow</label>
</div>
<div class="chart-container">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12.5em" height="12.5em" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve" class="svg-loader">
<defs>
<filter id="glow" x="-120%" y="-120%" width="400%" height="400%">
<feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"></feOffset>
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="10"></feGaussianBlur>
<feBlend in="SourceGraphic" in2="blurOut" mode="overlay"></feBlend>
</filter>
</defs>
<g transform = "rotate(-89 100 100)">
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="gray" />
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="svg-loader_grow cyan hair-line" role="progressbar" aria-valuenow="66" aria-valuemin="0" aria-valuemax="100"/>
</g>
</svg>
</div>
</article>
<article>
<input type="checkbox" name="valuenow-33" id="valuenow-33" class="valuenow-33" value="">
<div class="info">
<div>
<header>
<h3>Customize it.</h3>
</header>
<p>It's pretty easy to customize.</p>
<p>You can use svg filters too, but take care about the performance.</p>
</div>
<label for="valuenow-33">Change valuenow</label>
</div>
<div class="chart-container">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12.5em" height="12.5em" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve" class="svg-loader">
<defs>
<filter id="glow" x="-120%" y="-120%" width="400%" height="400%">
<feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"></feOffset>
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="10"></feGaussianBlur>
<feBlend in="SourceGraphic" in2="blurOut" mode="overlay"></feBlend>
</filter>
</defs>
<g>
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" filter="url(#glow)" class="svg-loader_grow lime" role="progressbar" aria-valuenow="85" aria-valuemin="0" aria-valuemax="100" transform = "rotate(-89 100 100)"/>
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="svg-loader_grow white" role="progressbar" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100" transform = "rotate(-89 100 100) scale(.8, .8) translate(25 25)"/>
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" filter="url(#glow)" class="white hair-line" transform = "scale(.8, .8) translate(25 25)"/>
</g>
</svg>
</div>
</article>
<article>
<input type="checkbox" name="valuenow-90" id="valuenow-90-0" class="valuenow-90" value="">
<div class="info">
<div>
<header>
<h3>Use Heat Bars.</h3>
</header>
<p>Build patterns to get a heat-bar with gradient-color steps.</p>
</div>
<label for="valuenow-90-0">Change valuenow</label>
</div>
<div class="chart-container">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12.5em" height="12.5em" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve" class="svg-loader">
<defs>
<linearGradient id="deg-0" gradientUnits="userSpaceOnUse" x1="50%" y1="0" x2="100%" y2="50%">
<stop offset="0" stop-color="#b2ff41" />
<stop offset="1" stop-color="#c5ce57" />
</linearGradient>
<linearGradient id="deg-1" gradientUnits="userSpaceOnUse" x1="100%" y1="50%" x2="50%" y2="100%">
<stop offset="0" stop-color="#c5ce57" />
<stop offset="1" stop-color="#d99d6d" />
</linearGradient>
<linearGradient id="deg-2" gradientUnits="userSpaceOnUse" x1="50%" y1="100%" x2="0" y2="50%">
<stop offset="0" stop-color="#d99d6d" />
<stop offset="1" stop-color="#ec6c83" />
</linearGradient>
<linearGradient id="deg-3" gradientUnits="userSpaceOnUse" x1="0" y1="50%" x2="50%" y2="0">
<stop offset="0" stop-color="#ec6c83" />
<stop offset="1" stop-color="#FF3B99" />
</linearGradient>
<filter id="blur" x="0" y="0" width="200%" height="200%">
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" />
<feBlend in="SourceGraphic" in2="blurOut" mode="normal" />
</filter>
<pattern id="heatCone" x="0" y="0" width="100%" height="100%" patternContentUnits="userSpaceOnUse" patternUnits="userSpaceOnUse">
<g transform = "rotate(89 100 100)">
<rect width='50%' height='50%' fill='url(#deg-0)' x="50%" />
<rect width='50%' height='50%' fill='url(#deg-1)' x="50%" y="50%" />
<rect width='50%' height='50%' fill='url(#deg-2)' y="50%" />
<rect width='50%' height='50%' fill='url(#deg-3)' />
</g>
</pattern>
<filter id="glow" x="-120%" y="-120%" width="400%" height="400%">
<feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"></feOffset>
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="10"></feGaussianBlur>
<feBlend in="SourceGraphic" in2="blurOut" mode="overlay"></feBlend>
</filter>
</defs>
<g transform = "rotate(-89 100 100)">
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="gray" />
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="svg-loader_grow thin" stroke="url(#heatCone)" stroke-width="2" role="progressbar" aria-valuenow="33" aria-valuemin="0" aria-valuemax="100"/>
</g>
</svg>
</div>
</article>
<article>
<div class="info">
<div>
<header>
<h3>Play with Colors.</h3>
</header>
<p>Just adding some colors we can code a temperature-color-behavior.</p>
</div>
</div>
<div class="chart-container">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12.5em" height="12.5em" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve" class="svg-loader">
<defs>
<filter id="glow" x="-120%" y="-120%" width="400%" height="400%">
<feOffset result="offOut" in="SourceGraphic" dx="0" dy="0"></feOffset>
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="10"></feGaussianBlur>
<feBlend in="SourceGraphic" in2="blurOut" mode="overlay"></feBlend>
</filter>
</defs>
<g>
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class=" gray" transform = "scale(.8, .8) translate(25 25)"/>
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="svg-loader_grow svg-loader_animate-color white" role="progressbar" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100" transform = "rotate(-89 100 100) scale(.8, .8) translate(25 25)" filter="url(#glow)"/>
<circle fill="none" cx="6.25em" cy="6.25em" r="5em" class="svg-loader_grow svg-loader_animate-color reflect-x white" role="progressbar" aria-valuenow="85" aria-valuemin="0" aria-valuemax="100" transform = "rotate(-89 100 100) translate(0 200) scale(1, -1)" filter="url(#glow)"/>
</g>
</svg>
</div>
</article>
</section>
<footer>
<header>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="222px" height="112px" viewBox="0 0 222 112" enable-background="new 0 0 222 112" xml:space="preserve" class="logo">
<path d="M163.464,55.536h-47.537C115.927,29.283,137.21,8,163.464,8 C189.717,8,211,29.283,211,55.536c0,26.254-21.283,47.537-47.536,47.537c-18.973,0-35.349-11.114-42.973-27.188l-18.787-40.283 C94.166,19.306,77.671,8,58.536,8C32.283,8,11,29.283,11,55.536c0,26.254,21.283,47.537,47.536,47.537 c26.254,0,47.537-21.283,47.537-47.537H58.536"/>
</svg>
</header>
</footer>
@import 'compass/css3';
@import 'compass/reset';
@import url(https://fonts.googleapis.com/css?family=Open+Sans:700,300);
$base-font: 'Open Sans', sans-serif;
$height: 26em;
$duration: .6s;
$blue: #57caf4;
$lime: #b2ff41;
$orange: #ff9d00;
$yellow: #f1c40f;
$green: #76c900;
$navy: #0a4069;
$cyan: #4CF2D8;
$white: #fefefe;
$gray: #444;
$dark: darken($gray, 10);
$red: #FF3B99;
$textColor: $gray;
$bezier: cubic-bezier(0.46,-0.42, 0.56, 1.37);
@function goldenCalc($amount) {
@return ($amount * 1.618) - $amount;
}
body
{
font-family: $base-font;
font-size: 16px;
text-align: center;
color: $textColor;
background: darken($white, 05);
background-image: linear-gradient(-45deg, $gray, $white);
// background-image: linear-gradient(-45deg, rgba($orange, 1), rgba($red, 1));
background-size: 100% 200%;
background-position: center center;
}
header
{
margin-bottom: 2em;
}
h1
{
font-size: 2em;
margin: 2em 0 1em;
}
h2
{
margin: 0 auto;
width: 16em;
line-height: 1.4em;
}
strong
{
font-weight: 700;
}
p
{
line-height: 1.5em;
margin-bottom: 1em;
&:last-child
{
margin: 0;
}
}
div
{
position: relative;
}
[aria-hidden="true"]
{
position: absolute;
height: 0;
text-indent: -900em;
}
$colorsList: (
lime: $lime,
red: $red,
orange: $orange,
yellow: $yellow,
blue: $blue,
cyan: $cyan,
green: $green,
gray: $gray,
dark: $dark,
white: $white
);
@each $name, $value in $colorsList
{
.#{$name}
{
color: $value;
}
}
[type="checkbox"]
{
display: none;
&:checked.valuenow-90 ~ .chart-container .svg-loader [aria-valuenow]
{
stroke-dashoffset: 50;
}
&:checked.valuenow-66 ~ .chart-container .svg-loader [aria-valuenow]
{
stroke-dashoffset: 170;
}
&:checked.valuenow-33 ~ .chart-container .svg-loader [aria-valuenow]
{
stroke-dashoffset: 335;
}
&:checked[class^="valuenow-"] ~ .info label
{
opacity: .4;
}
}
.header
{
padding-top: 4em;
.svg-loader
{
transform: scale(1.4);
}
}
article
{
display: flex;
flex-direction: row-reverse;
width: 40em;
height: goldenCalc(40em);
box-sizing: border-box;
margin: 4em auto;
padding: 3em;
background-size: 200% 100%;
background-position: 70% top;
border-radius: .4em;
// box-shadow :
// 0 1.7em 5.5em -.94em rgba($dark, 0.3),
// 0 2em 3em .5em rgba($dark, 0.1),
// 0 1.8em 2em -1.5em rgba($dark, 0.2);
.info
{
text-align: left;
display: flex;
flex-direction: column;
justify-content: space-between;
color: $white;
perspective: 900px;
flex: 0 1 14em;
padding-left: 2em;
label
{
transform-style: preserve-3d;
text-align: center;
opacity: 1;
color: $white;
border: 1px solid $white;
padding: 1.2em 1em;
margin-top: 1em;
border-radius: .2em;
transition: opacity .2s ease-in-out;
}
}
header
{
margin-bottom: 1.5em;
padding-bottom: 1.5em;
border-bottom: 1px dashed rgba($white, .8);
h3 {
font-size: 1.65em;
}
}
@media screen and (max-width: 480px) {
width: 90vw;
height: auto;
padding: 2.2em 2em;
margin: 4em auto;
align-items: center;
flex-direction: column-reverse;
.mobile-hide
{
display: none;
}
.info
{
// text-align: inherit;
flex: auto;
padding: 0;
margin: 3em 0 0;
label
{
margin-top: 2em;
}
}
}
}
.svg-loader
{
position: relative;
&_grow
{
stroke-miterlimit: 10;
stroke-dasharray: 500;
stroke-dashoffset: -500;
stroke-linejoin: round;
stroke-linecap: round;
@for $i from 0 to 101
{
&[aria-valuenow="#{$i}"]
{
stroke-dashoffset: 500 - ((500 * $i) / 100);
}
}
}
&_animate
{
animation: goBackGrow 20s $bezier infinite;
}
&_animate-color
{
animation: goBackColorGrow 4s ease-in-out infinite;
&.reflect-x
{
animation-name: backGoGrow;
animation-delay: .1s;
}
}
}
.logo
{
fill: none;
stroke: rgba($white, .6);
stroke-miterlimit: 10;
stroke-dasharray: 900;
stroke-dashoffset: 200;
stroke-linejoin: round;
stroke-linecap: round;
transform: scale(.4);
transform-origin: 50% 50%;
animation: backGoLogo 40s ease-in-out infinite;
}
@keyframes backGoLogo
{
5%
{
stroke-dashoffset: 900;
}
20%,
100%
{
stroke-dashoffset: 200;
}
}
circle
{
stroke-width: 6;
transition: all 1s ease-in-out;
position: relative;
&.fat
{
stroke-width: 8;
}
&.thin
{
stroke-width: 2;
}
&.hair-line
{
stroke-width: 1;
}
@each $name, $value in $colorsList
{
&.#{$name}
{
stroke: $value;
}
}
}
@keyframes backGoGrow
{
0%
{
stroke-dashoffset: 20;
}
50%
{
stroke-dashoffset: 480;
}
100%
{
stroke-dashoffset: 20;
}
}
@keyframes goBackColorGrow
{
0%
{
stroke-dashoffset: 480;
stroke: $red;
}
50%
{
stroke-dashoffset: 20;
stroke: $cyan;
}
100%
{
stroke-dashoffset: 480;
stroke: $red;
}
}
@keyframes goBackGrow
{
0%
{
stroke-dashoffset: 480;
}
25%
{
stroke-dashoffset: 400;
}
50%
{
stroke-dashoffset: 50;
}
75%
{
stroke-dashoffset: 200;
}
100%
{
stroke-dashoffset: 480;
}
}
Also see: Tab Triggers