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="funspinner">
<div class="funspinner__box">
<b>Hourglass</b>
<div class="hourglass">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 43.8 72.7" style="enable-background:new 0 0 43.8 72.7;" xml:space="preserve">
<path class="st0" d="M21.9,36.4c0,0-19.4-3-19.4-22.4V2.5h38.8V14C41.3,33.4,21.9,36.4,21.9,36.4z"/>
<path class="st1" d="M21.9,30.6C18.6,29.8,8.2,26.4,8.2,14V8.2h27.5V14C35.6,26.4,25.1,29.8,21.9,30.6z"/>
<path class="st0" d="M21.9,36.4c0,0-19.4,3-19.4,22.4v11.5h38.8V58.7C41.3,39.4,21.9,36.4,21.9,36.4z"/>
<path class="st2" d="M8.2,64.5v-5.8c0-12.5,10.6-15.9,13.7-16.6c3.3,0.8,13.7,4.2,13.7,16.6v5.8H8.2z"/>
</svg>
</div>
</div>
<div class="funspinner__box">
<b>Progresser</b>
<div class="progresser">
<div class="progresser__bar">
<div class="progresser__bar-item"></div>
</div>
</div>
</div>
<div class="funspinner__box">
<b>Elastic Ball</b>
<div class="elasticball">
<div class="elasticball__ball"><i></i></div>
</div>
</div>
<div class="funspinner__box">
<b>Face</b>
<div class="facespinner">
<div class="facespinner__eye"></div>
</div>
</div>
<div class="funspinner__box">
<b>Planet circle</b>
<div class="planetcircle">
<div class="planetcircle__a"></div>
<div class="planetcircle__b"></div>
</div>
</div>
<div class="funspinner__box">
<b>Text Transform</b>
<div class="texttransform">
<b>L</b><b>O</b><b>A</b><b>D</b><b>I</b><b>N</b><b>G</b>
</div>
</div>
<div class="funspinner__box">
<b>Box Transform</b>
<div class="linesquare">
<b></b><b></b><b></b><b></b><b></b>
</div>
</div>
<div class="funspinner__box">
<b>Sphere Border</b>
<div class="sphereborder">
<b></b><b></b><b></b><b></b>
</div>
</div>
<div class="funspinner__box">
<b>Scale Box</b>
<div class="scalebox">
<div></div><div></div>
</div>
</div>
<div class="funspinner__box">
<b>Gradient Level</b>
<div class="gradientlevel">
<div></div><div></div><div></div>
</div>
</div>
<div class="funspinner__box">
<b>Jumping Ball</b>
<div class="jumpingball"></div>
</div>
<div class="funspinner__box">
<b>Word Rotate</b>
<div class="word_rotate">
<span>
<b>AWSOME</b><b>AWSOME</b>
</span>
<span>
<b>AWSOME</b><b>AWSOME</b>
</span>
</div>
</div>
<div class="funspinner__box">
<b>Cross Line</b>
<div class="crossline">
<div>
<span></span><span></span><span></span><span></span>
</div>
</div>
</div>
</div>
<div class="tobe">
TO BE CONTINUE..., Made by <a href="https://e-s.tw">ES Design</a>
</div>
$primary: #c6c0ba;
$secondary: #ffffff;
$third: #000000;
html {font-size: 14px;}
body {
color: #fff;
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
font-family: sans-serif;
background-color: $primary;
}
.tobe {
position: fixed;
right: 2.4rem;
bottom: 2.4rem;
a {
color: $third;
}
}
.funspinner {
display: flex;
flex-wrap: wrap;
&__box {
width: 25vw;
height: 25vw;
margin: 0 0 0 -1px;
display: flex;
align-items: center;
box-sizing: border-box;
justify-content: center;
position: relative;
border: 1px solid rgba(255,255,255,.3);
&>b {
top: 1rem;
left: 1rem;
position: absolute;
font-weight: normal;
}
&>div {
width: 20%;
height: 20%;
text-align: center;
}
svg {
width: 100%;
height: 100%;
margin: 0 auto;
}
}
}
// @HOURGLASS
.hourglass {
transform: rotate(360deg);
animation: hourglass 2s 1s infinite;
.st0 {
fill:none;
stroke: $secondary;
stroke-width:3;
stroke-miterlimit:10;
}
.st1, .st2 {
fill: $third;
transform-origin: 50% 50%;
animation: hourglass1 2s infinite;
}
.st2 {
transform: scale(0);
animation: hourglass2 2s infinite;
}
}
@keyframes hourglass {
0% {
transform: rotate(0deg)
} 20% {
transform: rotate(180deg)
} 45% {
transform: rotate(180deg)
} 65% {
transform: rotate(360deg)
} 90% {
transform: rotate(360deg)
}
}
@keyframes hourglass1 {
10% {
transform: scale(1)
} 40% {
transform: scale(0)
} 60% {
transform: scale(0)
} 90% {
transform: scale(1)
}
}
@keyframes hourglass2 {
10% {
transform: scale(0)
} 40% {
transform: scale(1)
} 60% {
transform: scale(1)
} 90% {
transform: scale(0)
}
}
// @PROGRESSER
div.progresser {
width: 6rem;
height: auto;
&__bar {
width: 6rem;
height: .7rem;
border-radius: 1rem;
overflow: hidden;
background-color: $secondary;
&-item {
width: 3rem;
height: .7rem;
margin: 0 0 0 -2rem;
border-radius: 1rem;
background-color: $third;
animation: progresser 1.5s infinite cubic-bezier(0.76, 0, 0.24, 1);
}
}
}
@keyframes progresser {
0% {
transform: translateX(0)
} 50% {
transform: translateX(7rem)
} 100% {
transform: translateX(0)
}
}
// @ELASTIC BALL
div.elasticball {
display: flex;
justify-content: center;
position: relative;
height: 6rem;
&:before {
content: '';
width: 2rem;
height: 2rem;
bottom: 0;
opacity: 0;
border-radius: 50%;
position: absolute;
background-color: $secondary;
transform: scaleY(0.5) translateY(1rem);
animation: elasticball-bottom .5s .3s infinite;
}
&__ball {
width: 1.5rem;
height: 1.5rem;
transform-origin: 50% 100%;
animation: elasticball .5s infinite cubic-bezier(1,-0.01,0,1);
i {
width: 100%;
height: 100%;
display: block;
border-radius: 50%;
background-color: $secondary;
animation: elasticball-color 2s infinite;
}
}
}
@keyframes elasticball {
0% {
transform: translateY(0) scaleY(1)
} 50% {
transform: translateY(4rem) scaleY(.7)
} 100% {
transform: translateY(0) scaleY(1)
}
}
@keyframes elasticball-color {
0% {
background-color: $secondary;
} 30% {
background-color: $secondary;
} 50% {
background-color: $third;
} 80% {
background-color: $third;
}
}
@keyframes elasticball-bottom {
0% {
transform: scale(1, 0.5) translateY(1rem);
opacity: 0.3;
} 100% {
transform: scale(2, 0.5) translateY(1rem);
opacity: 0;
}
}
// @FACE SPINNER
div.facespinner {
width: 5rem;
height: 5rem;
border: 2px solid $secondary;
border-radius: 2.2rem;
display: flex;
justify-content: center;
&__eye {
width: 2.5rem;
position: relative;
transform: translate(-50%, 20%);
animation: facespinner 3s infinite cubic-bezier(0.76, 0, 0.24, 1) both;
&:before, &:after {
content: '';
left: 0;
width: .8rem;
height: .8rem;
border-radius: .8rem;
position: absolute;
background-color: $third;
animation: facespinnereye 1.5s 1s infinite;
}
&:after {
left: inherit;
right: 0
}
}
}
@keyframes facespinner {
0% {
transform: translate(-50%, 20%);
} 30% {
transform: translate(0%, 30%);
} 60% {
transform: translate(50%, 20%);
} 80% {
transform: translate(0%, 30%);
}
}
@keyframes facespinnereye {
0% {
transform: scaleY(1)
} 80% {
transform: scaleY(1)
} 85% {
transform: scaleY(0)
} 90% {
transform: scaleY(1)
} 95% {
transform: scaleY(0)
}
}
// @PLANET CIRCLE
.planetcircle {
position: relative;
animation: planetcircle 2s infinite linear;
&__a, &__b {
top: 50%;
left: 50%;
border-radius: 50%;
position: absolute;
}
&__a {
width: 3rem;
height: 3rem;
z-index: 1;
margin: -1.5rem 0 0 -1.5rem;
border: 5px solid $secondary;
transform: rotate(45deg);
animation: planetcircle_a 2s infinite cubic-bezier(0.76, 0, 0.24, 1);
}
&__b {
width: 1.5rem;
height: 1.5rem;
margin: -.75rem 0 0 -.75rem;
border: 5px solid $third;
animation: planetcircle_b 2s .3s infinite cubic-bezier(0.76, 0, 0.24, 1);
transform: rotate(-45deg);
}
}
@keyframes planetcircle {
0% {
transform: rotate(0deg)
} 100% {
transform: rotate(360deg)
}
}
@keyframes planetcircle_a {
0% {
transform: rotate(45deg) scaleY(1);
} 50% {
transform: rotate(45deg) scaleY(-1);
}
}
@keyframes planetcircle_b {
0% {
transform: rotate(-45deg) scaleY(1);
} 50% {
transform: rotate(-45deg) scaleY(-1);
}
}
// @TEXT @BOX TRNSFORM
div.linesquare,
div.texttransform {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
color: $third;
font-size: 2vw;
b {
transform: scaleY(0);
animation: texttransform_in 1.5s infinite cubic-bezier(0.76, 0, 0.24, 1);
@for $i from 0 to 10 {
&:nth-child(#{$i+1}) {
animation-delay: #{$i * 0.15}s;
}
}
}
}
div.linesquare {
b {
width: 2rem;
height: 2rem;
background-color: $secondary;
}
}
@keyframes texttransform_in {
0% {
transform-origin: 50% 100%;
transform: scaleY(0)
} 25% {
transform-origin: 50% 100%;
transform: scaleY(1)
} 75% {
transform-origin: 50% 0%;
transform: scaleY(1)
} 100% {
transform-origin: 50% 0%;
transform: scaleY(0)
}
}
// @SPHERE BORDER
div.sphereborder {
width: 10rem;
b {
top: 50%;
left: 50%;
width: 2rem;
height: 2rem;
transform: scale(0);
border-radius: 50%;
position: absolute;
border: 2px solid $third;
// background-color: $primary;
animation: sphereborder 3s infinite linear;
@for $i from 0 to 4 {
&:nth-child(#{$i+1}) {
animation-delay: #{$i * 0.4}s;
}
}
}
}
@keyframes sphereborder {
0% {
width: 1rem;
height: .3rem;
transform: translate(-50%, -3rem)
} 25% {
width: 4rem;
height: 1.5rem;
transform: translate(-50%, -2.7rem)
} 50% {
width: 6rem;
height: 3rem;
transform: translate(-50%, -2rem)
} 75% {
width: 4rem;
height: 1.5rem;
transform: translate(-50%, 0rem)
} 100% {
width: 1rem;
height: .3rem;
transform: translate(-50%, 1rem)
}
}
// @SCALE BOX
div.scalebox {
width: 40%;
display: flex;
align-items: center;
div {
width: 50%;
height: 2rem;
background-color: $secondary;
margin: 0 5px;
transform-origin: 0;
animation: scalebox 1.6s infinite both cubic-bezier(0.76, 0, 0.24, 1);
&:last-child {
transform-origin: 100%;
background-color: $third;
animation-delay: .8s;
}
}
}
@keyframes scalebox {
0% {
transform: scaleX(1.8)
} 50% {
transform: scaleX(.2)
} 100% {
transform: scaleX(1.8)
}
}
// @GRADIENT LEVEL
div.gradientlevel {
width: 25%;
height: 25%;
position: relative;
div {
width: 100%;
height: 100%;
border-radius: 50%;
background: rgb(0,0,0);
position: absolute;
left: 0;
top: 0;
animation: gradientlevel 2s infinite;
background: linear-gradient(0deg, rgba(255,255,255,1) 10%, rgba(0,0,0,1) 100%);
&:nth-child(2) {
width: 70%;
height: 70%;
margin: 15% 0 0 15%;
animation: gradientlevel2 2s infinite both linear;
}
&:nth-child(3) {
width: 40%;
height: 40%;
margin: 30% 0 0 30%;
animation: gradientlevel2 2s infinite both linear;
}
}
}
@keyframes gradientlevel {
0% {
transform: rotate(0deg)
}
100% {
transform: rotate(360deg)
}
}
@keyframes gradientlevel2 {
0% {
opacity: 0;
transform: rotate(0deg)
} 50% {
opacity: 1;
transform: rotate(180deg)
}
100% {
opacity: 0;
transform: rotate(360deg)
}
}
// @JUMPING BALL
div.jumpingball{
border: 2px solid #fff;
border-radius: 50%;
animation: jumpingball .4s infinite both cubic-bezier(0.76, 0, 0.24, 1);
box-sizing: border-box;
}
@keyframes jumpingball {
0% {
border-width: 5px;
transform: translateY(-1.5rem) scaleY(1.1)
} 50% {
border-width: 2px;
transform: translateY(0) scaleY(.9)
} 100% {
border-width: 5px;
transform: translateY(-1.5rem) scaleY(1.1)
}
}
// @WORD_ROTATE
div.word_rotate {
width: auto;
font-size: 1.6rem;
font-weight: bolder;
span {
display: flex;
position: relative;
b {
z-index: 1;
position: relative;
animation: wordrotate 3s infinite cubic-bezier(0.45, 0, 0.55, 1);
&:last-child {
opacity: 0;
top: 0;
left: 0;
position: absolute;
color: #000;
animation-delay: 1.5s;
}
}
&:last-child {
b {
animation-delay: .3s;
&:last-child {
animation-delay: 1.8s
}
}
}
}
}
@keyframes wordrotate {
0% {
opacity: 1;
transform-origin: 0 0;
transform: scaleX(0);
} 50% {
opacity: 1;
transform-origin: 0 0;
transform: scaleX(1);
} 51% {
opacity: 1;
transform-origin: 100% 100%;
transform: scaleX(1);
} 100% {
opacity: 1;
transform-origin: 100% 100%;
transform: scaleX(0);
}
}
//@crossline
$crosslineWidth: 3rem;
div.crossline {
width: $crosslineWidth;
height: $crosslineWidth;
> div {
width: 100%;
height: 100%;
position: relative;
animation: crosslineRotate 2s infinite;
> span {
position: absolute;
width: $crosslineWidth;
height: 2px;
background: $third;
transform: rotate(45deg);
animation: crosslineWidth 2s infinite;
&:nth-child(1) {
left: calc((-#{$crosslineWidth}) / 2);
top: 0;
}
&:nth-child(2) {
left: calc(100% - #{$crosslineWidth} / 2);
top: 0;
transform: rotate(-45deg);
}
&:nth-child(3) {
left: calc(100% - #{$crosslineWidth} / 2);
top: 100%;
}
&:nth-child(4) {
left: calc((-#{$crosslineWidth}) / 2);
top: 100%;
transform: rotate(-45deg);
}
}
}
@keyframes crosslineRotate {
0% {
transform: rotate(0deg) translate(0)
} 50% {
transform: rotate(180deg) translate(50%)
} 100% {
transform: rotate(360deg) translate(0)
}
}
@keyframes crosslineWidth {
0% {
width: $crosslineWidth;
} 50% {
width: 0;
} 100% {
width: $crosslineWidth;
}
}
}
Also see: Tab Triggers