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 URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
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.
If the stylesheet 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 CSS 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.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<p>Hover over the panels to see the effects :)
<div class="panels">
<a class="panel p0" href="#">
<div class="panel-info">
<h1>Rainbow.</h1>
Bouncing <code>transition</code> on
<code>background-size</code> and
<code>background-position</code>.
</div>
</a>
<a class="panel p1" href="#">
<div class="panel-info">
<h1>Sharp waves.</h1> Linear <code>transition</code> on
<code>background-position</code>.
</div>
</a>
<a class="panel p2" href="#">
<div class="panel-info">
<h1>Soft discs.</h1>
Bouncing <code>transition</code> on
<code>background-position</code> and
<code>background-size</code>.
</div>
</a>
<a class="panel p3" href="#">
<div class="panel-info">
<h1>White to...</h1>
Actually just a <code>transition</code> on the
<code>background-color</code> underneath the partially
transparent <code>linear-gradient</code>.
</div>
</a>
<a class="panel p4" href="#">
<div class="panel-info">
<h1>Crash into Jupiter.</h1>
Just a <code>transition</code> on
<code>background-size</code>
(scaling, aspect ratio preserved).
</div>
</a>
<a class="panel p5" href="#">
<div class="panel-info">
<h1>Stripes to ropes.</h1>
Another <code>transition</code> on
<code>background-size</code>
(distortion, aspect ratio not preserved).
</div>
</a>
<a class="panel p6" href="#">
<div class="panel-info">
<h1>Stretched rainbow.</h1>
Bouncing <code>transition</code> on
<code>background-position</code>.
</div>
</a>
<a class="panel p7" href="#">
<div class="panel-info">
<h1>T-Rex teeth.</h1>
Bouncing <code>transition</code> on
<code>background-size</code>.
</div>
</a>
<a class="panel p8" href="#">
<div class="panel-info">
<h1>Happy sine wave.</h1>
Another <code>transition</code> on
<code>background-position</code>.
</div>
</a>
<a class="panel p9" href="#">
<div class="panel-info">
<h1>Make a tablecloth.</h1>
Yet another <code>transition</code> on
<code>background-position</code>.
</div>
</a>
<a class="panel p10" href="#">
<div class="panel-info">
<h1>Bar chart.</h1>
Linear <code>transition</code> on both
<code>background-position</code> and
<code>background-size</code>.
</div>
</a>
<a class="panel p11" href="#">
<div class="panel-info">
<h1>Particles.</h1>
Bouncing <code>transition</code> on
<code>background-position</code>.
</div>
</a>
<a class="panel p12" href="#">
<div class="panel-info">
<h1>Horizontal bar chart.</h1>
Again <code>transition</code> on both
<code>background-position</code> and
<code>background-size</code>.
</div>
</a>
<a class="panel p13" href="#">
<div class="panel-info">
<h1>Changing angle.</h1>
Simulated using a bouncing <code>transition</code> on
<code>background-size</code>.
</div>
</a>
</div>
body {
font-family: Helvetica;
font-size: 15px;
}
h1 {
margin: 0 0 8px;
border-bottom: solid 1px white;
font-size: 23px;
font-style: italic;
}
code {
color: deeppink;
font-size: 17px;
}
.panel {
width: 195px;
height: 130px;
margin: 0 -1px 0 0;
border: solid 2px lightblue;
border-radius: 13px;
display: inline-block;
overflow: hidden;
text-decoration: none;
}
.panel-info {
bottom: 0;
right: 0;
left: 0;
padding: 8px 7px 19px;
display: none;
position: fixed;
background: #222;
color: white;
content: attr(data-inf);
}
.panel:hover .panel-info {
display: block;
}
.p0 {
background: linear-gradient(90deg,
hsl(0, 100%, 80%) 0%, hsl(35, 100%, 80%) 10%,
hsl(71, 100%, 80%) 20%, hsl(107, 100%, 80%) 30%,
hsl(143, 100%, 80%) 40%, hsl(179, 100%, 80%) 50%,
hsl(215, 100%, 80%) 60%, hsl(251, 100%, 80%) 70%,
hsl(287, 100%, 80%) 80%, hsl(323, 100%, 80%) 90%,
hsl(359, 100%, 80%) 100%);
background-size: 50% 1px;
background-position: 0 0;
transition: 3s cubic-bezier(0, 3.5, 1, -2.5);
}
.p0:hover {
background-size: 100% 1px;
background-position: -98px 0;
}
.p1 {
background: linear-gradient(-45deg, transparent 65%, midnightblue 65%)
-13px 0,
linear-gradient(45deg, transparent 65%, midnightblue 65%)
-13px 0,
linear-gradient(-45deg, midnightblue 35%, transparent 35%),
linear-gradient(45deg, midnightblue 35%, greenyellow 35%);
background-size: 26px 26px;
transition: 2s linear;
}
.p1:hover {
background-position: 182px 0, 182px 0, 195px 0, 195px 0;
}
.p2 {
background: radial-gradient(hotpink, white 70%) no-repeat 0 50%,
radial-gradient(gold, white 70%) no-repeat 50% 100%,
radial-gradient(greenyellow, white 70%) no-repeat 100% 50%,
radial-gradient(aqua, white 70%) no-repeat 50% 0;
background-size: 35px 35px;
transition: 3s cubic-bezier(0, 3.5, 1, -2.5);
}
.p2:hover {
background-position: 0 0, 0 100%, 100% 100%, 100% 0;
background-size: 25px 25px;
}
.p3 {
background: linear-gradient(90deg, white, transparent);
background-color: darkorange;
transition: 4s ease-in-out;
}
.p3:hover {
background-color: indigo;
}
.p4 {
background: radial-gradient(transparent 61%, black 65%)
no-repeat center,
radial-gradient(circle at 0% 0%,
rgb(123, 109, 100) 5%, rgb(182, 156, 132) 10%,
rgb(182, 156, 132) 15%, rgb(182, 156, 132) 20%,
rgb(196, 209, 228) 25%, rgb(197, 181, 155) 30%,
rgb(149, 133, 119) 35%, rgb(171, 168, 175) 40%,
rgb(165, 134, 116) 45%, rgb(182, 156, 132) 50%,
rgb(233, 232, 218) 55%, rgb(172, 150, 127) 60%,
rgb(154, 113, 81) 65%, rgb(214, 231, 232) 70%,
rgb(150, 138, 121) 75%, rgb(178, 164, 169) 80%,
rgb(173, 154, 144) 85%, rgb(179, 171, 160) 90%,
rgb(143, 127, 112) 95%, rgb(101, 95, 87) 100%)
no-repeat center;
background-color: black;
background-size: 26px 26px;
transition: all 3s ease-in;
}
.p4:hover {
background-size: 295px 295px;
}
.p5 {
background: linear-gradient(45deg, slateblue 20%, transparent 25%,
transparent 75%, slateblue 80%),
linear-gradient(-45deg, slateblue 20%, transparent 25%,
transparent 75%, slateblue 80%);
background-color: plum;
background-size: 10px 1px;
transition: all 1s ease-out;
}
.p5:hover {
background-size: 5px 20px;
}
/* THIRD ROW */
.p6 {
background: linear-gradient(hsl(0, 100%, 80%) 0%, hsl(35, 100%, 80%) 10%,
hsl(71, 100%, 80%) 20%, hsl(107, 100%, 80%) 30%,
hsl(143, 100%, 80%) 40%, hsl(179, 100%, 80%) 50%,
hsl(215, 100%, 80%) 60%, hsl(251, 100%, 80%) 70%,
hsl(287, 100%, 80%) 80%, hsl(323, 100%, 80%) 90%,
hsl(359, 100%, 80%) 100%);
background-size: 1px 390px;
background-position: 0 0;
transition: 4s cubic-bezier(0, 2, 1, -1);
}
.p6:hover {
background-position: 0 100%;
}
.p7 {
background: linear-gradient(-45deg, transparent 67%, seashell 67%)
-13px 50%,
linear-gradient(45deg, transparent 67%, seashell 67%)
-13px 50%,
linear-gradient(-45deg, seashell 33%, transparent 33%) 0 50%,
seashell linear-gradient(45deg, seashell 33%, saddlebrown 33%) 0 50%;
background-repeat: repeat-x;
background-size: 26px 26px;
transition: 3.5s cubic-bezier(0, 3, 1, -2);
}
.p7:hover {
background-size: 26px 260px;
}
.p8 {
background: radial-gradient(hsl(359, 100%, 80%) 20%, black 70%) -10% 80%,
radial-gradient(hsl(0, 100%, 80%) 20%, black 70%) 0 50%,
radial-gradient(hsl(35, 100%, 80%) 20%, black 70%) 10% 20%,
radial-gradient(hsl(71, 100%, 80%) 20%, black 70%) 25% 0,
radial-gradient(hsl(107, 100%, 80%) 20%, black 70%) 40% 20%,
radial-gradient(hsl(143, 100%, 80%) 20%, black 70%) 50% 50%,
radial-gradient(hsl(179, 100%, 80%) 20%, black 70%) 60% 80%,
radial-gradient(hsl(215, 100%, 80%) 20%, black 70%) 75% 100%,
radial-gradient(hsl(251, 100%, 80%) 20%, black 70%) 90% 80%,
radial-gradient(hsl(287, 100%, 80%) 20%, black 70%) 100% 50%,
radial-gradient(hsl(323, 100%, 80%) 20%, black 70%) 110% 20%,
radial-gradient(hsl(359, 100%, 80%) 20%, black 70%) 125% 0;
background-color: black;
background-repeat: no-repeat;
background-size: 26px 26px;
transition: .3s cubic-bezier(0, 0.25, 1, .75);
}
.p8:hover {
background-position: -25% 100%, -10% 80%, 0 50%, 10% 20%, 25% 0, 40% 20%,
50% 50%, 60% 80%, 75% 100%, 90% 80%, 100% 50%, 110% 20%;
}
.p9 {
background: linear-gradient(90deg, darkcyan 37%, transparent 47%)
repeat-x -3px 128px,
linear-gradient(darkcyan 37%, transparent 47%) repeat-y 193px -3px;
background-size: 13px 135px, 200px 13px;
transition: .5s ease;
}
.p9:hover {
background-position: -3px 0, 0 -3px;
}
.p10 {
background: linear-gradient(transparent 49%, black 49%,
black 51%, transparent 51%) repeat-x 0 40px,
linear-gradient(deeppink, white) no-repeat 26px 49%,
linear-gradient(gold, white) no-repeat 65px 49%,
linear-gradient(lemonchiffon, greenyellow) no-repeat 104px 50%,
linear-gradient(aqua, white) no-repeat 143px 49%;
background-color: indigo;
background-size: 1px 50px, 26px 1px, 26px 1px, 26px 1px, 26px 1px;
transition: .2s linear;
}
.p10:hover {
background-position: 0 40px, 26px 37%, 65px 17%, 104px 55%, 143px 29%;
background-size: 1px 50px, 26px 26px, 26px 52px, 26px 13px, 26px 39px;
}
.p11 {
background: radial-gradient(deeppink, transparent 16px) 20% 100%,
radial-gradient(gold, transparent 16px) 40% 100%,
radial-gradient(greenyellow, transparent 16px) 60% 100%,
radial-gradient(aqua, transparent 16px) 80% 100%;
background-repeat: no-repeat;
background-size: 26px 26px;
background-color: black;
transition: 2.5s cubic-bezier(0, 3.25, 1, -2.25);
}
.p11:hover {
background-position: 100% 0, 75% 50%, 25% 0, 0 50%;
}
.p12 {
background: linear-gradient(90deg, lightblue, deeppink) 0 15%,
linear-gradient(90deg, lightblue, gold) 0 50%,
linear-gradient(90deg, lightblue, greenyellow) 0 85%,
linear-gradient(lemonchiffon, orchid) 0 0;
background-repeat: no-repeat;
background-size: 91px 26px, 78px 26px, 156px 26px, 195px 195px;
transition: background-size .85s cubic-bezier(0, .35, 1, .65),
background-position 1.25s .5s ease-in-out;
}
.p12:hover {
background-position: -5px 15%, -5px 50%, -5px 85%, 0 -65px;
background-size: 1px 26px, 1px 26px, 1px 26px, 195px 195px;
}
.p13 {
background: -webkit-linear-gradient(left top, orangered 49%, lemonchiffon 51%)
50% 50%;
background: linear-gradient(to right bottom, orangered 49%, lemonchiffon 51%)
50% 50%;
background-size: 195px 156px;
transition: 2.75s cubic-bezier(0, 3.25, 1, -2.25);
}
.p13:hover {
background-size: 195px 390px;
}
Also see: Tab Triggers