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.
.ground
.snowglobe
.sg-bg
.grnd-snow
.snow-surface
.tree
.tree-shadow
.branch-bot
.branch-bot-snow
.branch-shadow
.branch-mid
.branch-mid-snow
.branch-shadow
.branch-top
.branch-top-snow
.star
.baubles
.sm-shadow
.snowman
.snowman-bot
.snowman-top
.coal
.carrot
.falling-snow-wrap
.falling-snow
.flakes1
p *
.flakes2
p *
.sg-fg
.stand-curved-wrap
.stand-curved
$snow-col : #dbe8fc;
$sg-size : 400px;
$tree-size : 50px;
@mixin test {
border:1px solid black;
}
@mixin sg-base {
width: $sg-size;
height: $sg-size;
border-radius:100%;
position:absolute;
top:0px;
}
@mixin smaller-base {
width: $sg-size*0.95;
height: $sg-size*0.95;
border-radius:100%;
position:absolute;
top: $sg-size*0.025;
left: $sg-size*0.025;
}
$zz-size: $tree-size*2;
@mixin snow-pattern {
background:
linear-gradient(135deg, $snow-col 25%, transparent 25%) $zz-size*-0.16 0,
linear-gradient(225deg, $snow-col 25%, transparent 25%) $zz-size*-0.16 0,
linear-gradient(315deg, $snow-col 25%, transparent 25%),
linear-gradient(45deg, $snow-col 25%, transparent 25%);
background-size: $zz-size*0.32 $zz-size*0.32;
width:100%;
height:100%;
position:absolute;
}
body {
background:#9b3715;
margin:10px 0px 0px 0px;
padding:0px;
}
.snowglobe {
width: $sg-size;
height: $sg-size;
margin:auto;
position:relative;
}
.branch-top {
-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
width: $tree-size*0.8;
height: $tree-size*1.5;
background-color: #62838C;
position:absolute;
top: $tree-size*0.1;
left: $tree-size*0.6;
}
.branch-top-snow {
@include snow-pattern;
}
.branch-mid {
-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
width: $tree-size*1.5;
height: $tree-size*2.3;
background-color: #2D4959;
position:absolute;
top: $tree-size*0.7;
left: $tree-size*0.25;
}
.branch-mid-snow {
@include snow-pattern;
}
.branch-bot {
-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
width: $tree-size*2;
height: $tree-size*2.5;
background-color: #142833;
position:absolute;
top: $tree-size*1.6;
}
.branch-bot-snow {
@include snow-pattern;
}
.branch-shadow {
width:100%;
height:100%;
position:absolute;
background: linear-gradient(to bottom, rgba(18, 67, 79, 1) 0%, rgba(255,255,255,0) 100%);
mix-blend-mode:multiply;
}
.tree {
width:$tree-size*2;
height:$tree-size*4.1;
position:relative;
left: $sg-size*0.5;
top: $sg-size*0.15;
//border:1px solid black;
}
.sg-bg {
@include sg-base;
background: rgba(255, 255, 255, 0.5);
}
.sg-fg {
@include sg-base;
background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(246,246,246,0.2) 47%, rgba(237,237,237,0) 100%);
}
.grnd-snow {
@include smaller-base;
background: linear-gradient(to bottom, rgba(255,255,255,0) 68%, rgba(240,240,240,1) 68%, rgba(235,239,245,1) 79%, rgba(197,211,232,1) 100%);
}
.snow-surface {
width:$sg-size*0.89;
height:$sg-size*0.1;
background: #fff;
position:relative;
top:$sg-size*0.59;
border-radius:100%;
margin:auto;
}
$star-size : 20px;
.star {
width: 0px;
height: 0px;
border-right: $star-size solid transparent;
border-bottom: $star-size*0.7 solid gold;
border-left: $star-size solid transparent;
transform: rotate(35deg);
position:absolute;
top:0px;
left: $tree-size*0.6;
}
.star:before {
border-bottom: $star-size*0.8 solid gold;
border-left: $star-size*0.3 solid transparent;
border-right: $star-size*0.3 solid transparent;
position: absolute;
height: 0;
width: 0;
top: $star-size*-0.45;
left: $star-size*-0.65;
content: '';
transform: rotate(-35deg);
}
.star:after {
position: absolute;
top: $star-size*0.03;
left: $star-size*-1.05;
width: 0px;
height: 0px;
border-right: $star-size solid transparent;
border-bottom: $star-size*0.7 solid gold;
border-left: $star-size solid transparent;
transform: rotate(-70deg);
content: '';
}
.falling-snow-wrap {
overflow:hidden;
opacity:0.99;
height:$sg-size*0.65;
width:$sg-size;
position:absolute;
top:0px;
}
.falling-snow {
@include smaller-base;
overflow:hidden;
opacity:0.99;
}
.flakes1 {
width: $sg-size;
height: $sg-size*2;
position:absolute;
top:0px;
color:#fff;
opacity: 0.5;
animation: sfanim linear 30s;
animation-iteration-count: infinite;
text-shadow:303px 117px, 32px 89px, 323px 119px, 98px 183px, 126px 235px, 0px 171px, 380px 61px, 269px 17px, 0px 151px, 121px 344px, 229px 136px, 237px 280px, 303px 30px, 211px 314px, 378px 285px, 10px 287px, 93px 345px, 292px 324px, 223px 292px, 156px 160px, 253px 58px, 205px 195px, 145px 106px, 79px 312px, 182px 359px, 279px 99px, 349px 124px, 5px 33px, 216px 147px, 388px 117px, 70px 295px, 149px 318px, 96px 66px, 129px 217px, 138px 218px, 241px 310px, 231px 368px, 18px 327px, 173px 213px, 118px 10px, 246px 208px, 159px 244px, 268px 376px, 167px 262px, 85px 238px, 277px 47px, 386px 192px, 259px 364px, 325px 327px, 279px 201px, 303px 517px, 32px 489px, 323px 519px, 98px 583px, 126px 635px, 0px 571px, 380px 461px, 269px 417px, 0px 551px, 121px 744px, 229px 536px, 237px 680px, 303px 430px, 211px 714px, 378px 685px, 10px 687px, 93px 745px, 292px 724px, 223px 692px, 156px 560px, 253px 458px, 205px 595px, 145px 506px, 79px 712px, 182px 759px, 279px 499px, 349px 524px, 5px 433px, 216px 547px, 388px 517px, 70px 695px, 149px 718px, 96px 466px, 129px 617px, 138px 618px, 241px 710px, 231px 768px, 18px 727px, 173px 613px, 118px 410px, 246px 608px, 159px 644px, 268px 776px, 167px 662px, 85px 638px, 277px 447px, 386px 592px, 259px 764px, 325px 727px, 279px 601px;
}
.flakes2 {
width: $sg-size;
height: $sg-size*2;
position:absolute;
top:0px;
color:#fff;
animation: sfanim linear 15s;
animation-iteration-count: infinite;
text-shadow:375px 485px, 11px 689px, 254px 784px, 5px 686px, 266px 705px, 388px 698px, 180px 707px, 36px 413px, 74px 695px, 238px 690px, 384px 635px, 1px 694px, 45px 538px, 131px 750px, 258px 520px, 157px 705px, 96px 749px, 325px 719px, 132px 688px, 167px 511px, 303px 408px, 340px 620px, 394px 428px, 187px 748px, 217px 624px, 356px 630px, 33px 758px, 238px 762px, 357px 586px, 253px 798px, 68px 786px, 164px 662px, 119px 598px, 221px 557px, 126px 537px, 282px 503px, 11px 455px, 219px 632px, 60px 597px, 41px 529px, 247px 451px, 217px 644px, 304px 400px, 214px 421px, 287px 757px, 76px 404px, 376px 735px, 169px 572px, 245px 790px, 66px 717px, 375px 85px, 11px 289px, 254px 384px, 5px 286px, 266px 305px, 388px 298px, 180px 307px, 36px 13px, 74px 295px, 238px 290px, 384px 235px, 1px 294px, 45px 138px, 131px 350px, 258px 120px, 157px 305px, 96px 349px, 325px 319px, 132px 288px, 167px 111px, 303px 8px, 340px 220px, 394px 28px, 187px 348px, 217px 224px, 356px 230px, 33px 358px, 238px 362px, 357px 186px, 253px 398px, 68px 386px, 164px 262px, 119px 198px, 221px 157px, 126px 137px, 282px 103px, 11px 55px, 219px 232px, 60px 197px, 41px 129px, 247px 51px, 217px 244px, 304px 0px, 214px 21px, 287px 357px, 76px 4px, 376px 335px, 169px 172px, 245px 390px, 66px 317px;
}
@keyframes sfanim {
0% {transform: translate(0px,$sg-size*-1);}
100% {transform: translate(0px,0px);}
}
.baubles {
width:$sg-size*0.04;
height:$sg-size*0.04;
background-color:rgba(191, 17, 49,1);
border-radius:100%;
position:absolute;
top:$sg-size*0.1;
left:$sg-size*0.1;
box-shadow: $sg-size*0.02 $sg-size*0.11 0px 0px rgba(150, 0, 40,1), $sg-size*-0.02 $sg-size*0.2 0px 0px rgba(206, 0, 55,1), $sg-size*0.05 $sg-size*0.25 0px 0px rgba(206, 0, 37,1), $sg-size*-0.06 $sg-size*0.33 0px 0px rgba(191, 17, 49,1), $sg-size*0.08 $sg-size*0.35 0px 0px rgba(191, 17, 49,1);
}
.tree-shadow {
width:$tree-size*4;
height:20px;
background: radial-gradient(ellipse at center, rgba(13,84,102,1) 0%, rgba(138,174,188,0) 65%, rgba(206,223,235,0) 100%);
position:absolute;
bottom:$tree-size*-0.2;
left:$tree-size*-0.7;
}
.stand-curved {
height:180px;
width:500px;
border-radius:50%;
border:100px solid maroon;
position:absolute;
bottom:0px;
left:-70px;
}
.stand-curved-wrap {
width: $sg-size*1.4;
height: $sg-size/3;
position:absolute;
bottom:$sg-size*-0.34;
margin-left:$sg-size*-0.2;
position:relative;
-webkit-clip-path: polygon(30% 10%, 70% 10%, 80% 100%, 20% 100%);
}
.ground {
width:100%;
height:150px;
position:absolute;
top:$sg-size;
background: radial-gradient(ellipse at center, rgba(1,1,1,1) 0%, rgba(1,1,1,0.7) 10%, rgba(1,1,1,0) 20%), linear-gradient(to bottom, rgba(37,5,6,1) 0%, rgba(99,19,7,1) 40%, rgba(164,65,33,1) 100%);
}
.sm-shadow {
width:$tree-size*2;
height:20px;
background: radial-gradient(ellipse at center, rgba(13,84,102,0.4) 0%, rgba(138,174,188,0) 65%, rgba(206,223,235,0) 100%);
position:absolute;
bottom:$tree-size*2.5;
left:$tree-size*1.8;
}
.snowman-bot {
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, $snow-col 100%);
width: $sg-size*0.15;
height: $sg-size*0.15;
border-radius:50%;
position:absolute;
bottom:$sg-size*0.33;
left:$sg-size*0.25;
}
.snowman-top {
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, $snow-col 100%);
width: $sg-size*0.1;
height: $sg-size*0.1;
border-radius:50%;
position:absolute;
bottom:$sg-size*0.46;
left:$sg-size*0.27;
}
.coal {
width:5px;
height:5px;
border-radius:50%;
position:absolute;
box-shadow: 120px -10px 0px 0px black, 137px -12px 0px 0px black, 119px 0px 0px 0px black, 125px 2px 0px 0px black, 132px 2px 0px 0px black, 138px -2px 0px 0px black, 130px 15px 0px 0px black, 132px 27px 0px 0px black, 132px 39px 0px 0px black;
}
.carrot {
width:0px;
height:0px;
border-left:20px solid #f98e13;
border-top:3px solid transparent;
border-bottom:3px solid transparent;
position:absolute;
left:130px;
top:198px;
}
Also see: Tab Triggers