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.
.ctnr
.title
.cake
.plate
.crust
.filling
.toping
.coulis
.drips
.lemon
.rasberries
@import 'compass/css3';
@import url("https://fonts.googleapis.com/css?family=Khula:400,700,800|Lilita+One|Rammetto+One|Seymour+One");
*{box-sizing: content-box; text-align: center;}
$bg: plum;
$Lil: 'Lilita One', cursive;
$Ram: 'Rammetto One', cursive;
$Khu: 'Khula', sans-serif;
$Sey: 'Seymour One', sans-serif;
$plate: #F2DAF0; $P: $plate;
$crust: #E5AC72; $C: $crust;
$lemon: #FFFC4C; $L: $lemon;
$raspberry: #B21127; $R: $raspberry;
$toping: $R + 70; $T: $toping;
html,body{
width: 100%;
height: 100%;
overflow: hidden;
background: $bg;
}
div{
position: absolute;
&:before, &:after {
content: "";
position: absolute;
}
}
.ctnr{
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
overflow: hidden;
text-align: center;
height: 450px;
width: 600px;
}
.title{
left: 0;
top: 0;
height: 160px;
width: 100%;
&:before {
top: 0;
left: 0;
width: inherit;
color: $T;
white-space: pre;
content: "Day 14 : \A Cheese Cake";
font-family: $Ram;
font-size: 50px;
line-height: 1.1em;
@include text-shadow(
0 1px $R
)
}
&:after {
bottom: 0;
left: 0;
width: inherit;
color: $R;
content:
"#Daily CSS Images";
font-family: $Khu;
font-size: 28px;
font-weight: 500;
line-height: 1.2em;
}
}
.cake{
left: 0;
bottom: 0;
right: 0;
margin: auto;
background: radial-gradient(ellipse at center, $bg - 50 60%, $bg 70%);
height: 165px;
width: 600px;
@include border-radius(100%);
}
.plate{
left: 0;
bottom: 20px;
right: 0;
margin: auto;
background: $P;
height: 150px;
width: 550px;
@include border-radius(100%);
@include box-shadow(
inset 0 0 0 1px $P - 25,
0 6px 0 0 $P - 50
);
&:after{
top: 30px;
left: 0;
right: 0;
margin: auto;
background: $P;
height: 80px;
width: 395px;
@include border-radius(100%);
@include box-shadow(
inset 0 0 0 1px $P - 15,
inset -2px 0 0 0 $P - 50,
inset -2px 3px 0 0 $P - 50,
inset 0 3px 0 0 $P - 50
);
}
}
.crust{
left: 0;
bottom: 90px;
right: 0;
margin: auto;
background: $C;
height: 20px;
width: 300px;
@include border-radius(0 0 0 4px);
@include box-shadow(
inset 5px 0 $C - 30,
inset 5px -3px $C - 30
);
&:after{
top: 2px;
left: 10px;
background: $C - 20;
height: 5px;
width: 5px;
@include border-radius(5px);
@include box-shadow(
10px 6px $C - 30,
16px 2px $C - 15,
30px 1px $C - 25,
35px 4px $C - 30,
50px 7px $C - 20,
65px 2px $C - 35,
85px 4px $C - 40,
90px 6px $C - 50,
90px 2px $C - 20,
110px 1px $C - 15,
115px 2px $C - 35,
130px 8px $C - 45,
150px 4px $C - 30,
160px 6px $C - 50,
180px 4px $C - 20,
200px 2px $C - 15,
230px 6px $C - 30,
235px 2px $C - 40,
240px 8px $C - 20,
260px 1px $C - 50,
275px 5px $C - 30
);
}
}
.filling{
left: 0;
bottom: 110px;
right: 0;
margin: auto;
background: $L + 120;
height: 100px;
width: 300px;
@include box-shadow(
inset 5px 0 $L + 40,
inset 0 -40px $L + 80
);
}
.toping{
left: 0;
bottom: 210px;
right: 0;
margin: auto;
height: 50px;
width: 300px;
&:before{
left: 30px;
bottom: -9px;
background: linear-gradient(5deg, $T 65%, $T + 30 65%);
height: 50px;
width: 270px;
@include transform(rotate(4.5deg) skewx(-50deg));
-webkit-clip-path: polygon(0 0, 268px 24px, 270px 26px, 0 50px);
clip-path: polygon(0 0, 268px 24px, 270px 26px, 0 50px);
@include border-radius(4px 0 0 0);
@include box-shadow(inset 5px 0 $R + 50);
}
&:after{
left: 0;
bottom: 0;
right: 0;
margin: auto;
background: linear-gradient(to right, $T - 20, $T + 30 50%);
height: 6px;
width: 300px;
z-index: 2;
@include border-radius(4px 0 0 0);
@include box-shadow(
inset -2px 0 $T + 30,
inset 5px 0 $T - 40,
inset 0 -4px $T - 20
);
}
}
.coulis{
left: 185px;
bottom: 218px;
height: 26px;
width: 105px;
background: $R - 40;
@include transform(skewy(1deg));
@include border-radius(100%);
@include box-shadow(
inset 2px -2px $R - 40,
inset 5px -2px $R + 10,
0 2px $R - 60,
inset -2px 1px $R - 40,
inset -3px 3px $R + 30
);
}
.drips{
background: $T - 20;
@include border-radius(10px);
left: 160px;
bottom: 202px;
height: 13px;
width: 10px;
@include box-shadow(
0 4px $T - 40,
10px 0 $T - 20,
10px 4px $T - 20,
10px 8px $T - 20,
10px 12px $T - 20,
10px 16px $T - 40,
20px 0 $T - 20,
20px 4px $T - 20,
20px 8px $T - 40,
40px 0 $T - 20,
40px 4px $T - 40,
120px 0 $T - 20,
120px 4px $T - 40,
180px 0 $T - 20,
180px 4px $T - 40,
190px 0 $T - 20,
190px 4px $T - 20,
190px 8px $T - 20,
190px 12px $T - 40,
220px 0 $T - 20,
220px 4px $T - 40,
258px 0 $T - 20,
258px 4px $T - 40,
268px 0 $T - 20,
268px 4px $T - 20,
268px 8px $T - 20,
268px 12px $T - 20,
268px 16px $T - 40,
278px 0 $T - 20,
278px 4px $T - 40,
280px 0 $T + 30,
280px 4px $T + 30
);
}
.lemon{
left: 200px;
bottom: 230px;
background: radial-gradient(circle at center bottom, $L + 50 58%, $L + 100 58%, $L + 100 65%, $L + 30 65%);
height: 37px;
width: 75px;
@include transform(skew(-4deg, 4deg));
@include border-radius(100px 100px 0 0);
@include box-shadow(
1px 0 $L,
2px -1px $L,
3px -2px $L,
4px -3px $L,
5px -4px $L
);
&:after{
left: 0;
bottom: 10px;
right: 0;
margin: auto;
height: 40px;
width: 40px;
@include transform(scalex(0.75) rotate(45deg));
@include box-shadow(
4px 4px $L + 100
);
}
}
raspberry{
background: $R;
height: 8px;
width: 8px;
@include border-radius();
@include box-shadow(
// highlight first
0 -2px $R + 50,
1px -1px $R + 50,
// first line
6px 0 $R,
6px -2px $R + 50,
7px -1px $R + 50,
12px 0 $R,
12px -2px $R + 50,
13px -1px $R + 50,
-6px 0 $R,
-6px -2px $R + 50,
-5px -1px $R + 50,
-12px 0 $R,
-12px -2px $R + 50,
-11px -1px $R + 50,
// second line
0 -8px $R,
0 -10px $R + 50,
1px -9px $R + 50,
7px -8px $R,
7px -10px $R + 50,
8px -9px $R + 50,
0 -8px $R,
0 -10px $R + 50,
1px -9px $R + 50,
-7px -8px $R,
-7px -10px $R + 50,
-6px -9px $R + 50,
-12px -8px $R,
-12px -10px $R + 50,
-11px -9px $R + 50,
// third line
12px -8px $R,
12px -10px $R + 50,
13px -9px $R + 50,
3px -15px $R,
3px -17px $R + 50,
4px -16px $R + 50,
9px -15px $R,
9px -17px $R + 50,
10px -16px $R + 50,
-3px -15px $R,
-3px -17px $R + 50,
-2px -16px $R + 50,
-9px -15px $R,
-9px -17px $R + 50,
-8px -16px $R + 50,
// fourth line
4px -22px $R,
4px -24px $R + 50,
5px -23px $R + 50,
-3px -21px $R,
-3px -23px $R + 50,
-2px -22px $R + 50
);
}
.rasberries{
left: 220px;
bottom: 250px;
height: 5px;
width: 5px;
@include border-radius();
@include box-shadow(
-42px 27px $R + 20,
-24px 34px $R + 45,
66px 34px $R + 40,
76px 21px $R + 20,
80px 30px $R + 35,
90px 16px $R + 40,
95px 30px $R + 50,
100px 19px $R + 45,
110px 24px $R + 25,
125px 32px $R + 40,
135px 26px $R + 30,
145px 30px $R + 20,
155px 28px $R + 50,
170px 32px $R + 25,
185px 33px $R + 40
);
&:before{
left: 2px;
bottom: -25px;
@include transform(scale(0.8) rotate(2deg) skewx(-5deg));
@extend raspberry;
}
&:after{
left: 25px;
bottom: -26px;
@include transform(scale(0.7) rotate(-2deg) skewx(-5deg));
@extend raspberry;
}
}
Also see: Tab Triggers