cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!-- Looks better in webkit browsers -->

<div class="scene">
  <div class="sky">
    <div class="sky__stars"></div>
    <div class="sky__crescent"></div>
  </div>

  <div class="ground">
    <div class="ground__snowdrift"></div>
    <div class="ground__snowdrift"></div>
    <div class="ground__snowdrift"></div>
  </div>

  <div class="xmass-tree">
    <div class="xmass-tree__bottom"></div>
    <div class="xmass-tree__middle">
      <div class="snowflake  snowflake--medium  snowflake--tree">
        <div class="snowflake__ray"></div>
        <div class="snowflake__ray"></div>
        <div class="snowflake__ray"></div>
        <div class="snowflake__center"></div>
      </div>
    </div>
    <div class="xmass-tree__top"></div>
  </div>

  <div class="snowman">
    <div class="snowman__snowball">
      <div class="button  button--bottom"></div>
      <div class="button  button--bottom"></div>
    </div>
    <div class="snowman__snowball">
      <div class="button  button--torso"></div>
      <div class="button  button--torso"></div>
      <div class="stick  stick--left"></div>
      <div class="stick  stick--right"></div>
    </div>
    <div class="snowman__snowball">
      <div class="button  button--head"></div>
      <div class="button  button--head"></div>
      <div class="carrot"></div>
    </div>
  </div>

  <div class="snowflake  snowflake--small  snowflake--air">
    <div class="snowflake__ray"></div>
    <div class="snowflake__ray"></div>
    <div class="snowflake__ray"></div>
    <div class="snowflake__center"></div>
  </div>
</div>
            
          
!
            
              //////////////////////////////
//  B A S E
//////////////////////////////

@snow: snow;
@brown: #754f44;
@red: #f25f5c;
@orange: #ff6f59;
@green: #254441;
@blue: #0b132b;

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
}



//////////////////////////////
//  S C E N E
//////////////////////////////

.scene {
  position: relative;
  height: 100vh;
  background: @blue radial-gradient(circle farthest-side at 50% 100%, desaturate(lighten(@blue, 45%), 30%), @blue) no-repeat;
  overflow: hidden;
}



//////////////////////////////
//  S K Y
//////////////////////////////

.sky {
  position: absolute;
  width: 100%;
  height: 60%;
  /* outline: 1px dotted yellow; */
  /* outline-offset: -5px; */
  
  &__stars {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background-color: @snow;
    border-radius: 50%;
    box-shadow:
      -550px 5px 0 0 @snow,
      -405px -45px 0 0 @snow,
      -300px -165px 0 0 @snow,
      -230px -75px 0 0 @snow,
      -130px 100px 0 0 @snow,
      -120px -160px 0 0 @snow,
      160px -135px 0 0 @snow,
      375px -50px 0 0 @snow,
      435px 80px 0 0 @snow,
      480px -75px 0 0 @snow; 
    animation: shine 5s infinite;

    &::before {
      content: "";
      position: absolute;
      top: 35px;
      left: -60px;
      width: 2px;
      height: 2px;
      background-color: @snow;
      box-shadow:
        -460px -145px 0 0 @snow,
        -405px 45px 0 0 @snow,
        -255px -40px 0 0 @snow,
        -230px 75px 0 0 @snow,
        -40px -100px 0 0 @snow,
        130px 90px 0 0 @snow,
        160px -115px 0 0 @snow,
        300px -40px 0 0 @snow,
        350px -185px 0 0 @snow,
        610px -175px 0 0 @snow;
    }
  }
  
  &__crescent {
    position: absolute;
    top: 75px;
    right: 50%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    box-shadow: inset -20px 20px 0 -10px #fff;
    transform: rotate(40deg);
    animation: shine 5s infinite;
  }
}



//////////////////////////////
//  G R O U N D
//////////////////////////////

.ground {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 40%;
  overflow: hidden;
  /* outline: 1px dotted yellow; */
  
  &__snowdrift {
    position: absolute;
    bottom: 0;
    clip-path: polygon(
      0% 15%,
      10% 5%,
      20% 0%,
      30% 2%,
      40% 10%,
      50% 15%,
      60% 12%,
      70% 6%,
      80% 5%,
      90% 10%,
      100% 20%,
      100% 100%,
      0% 100%
    );
    
    &:first-child {
      width: 100%;
      height: 60%;
      background-color: @snow;
    }  
    &:nth-child(2) {
      width: 125%;
      height: 85%;
      background-color: fade(@snow, 80%);
    }
    &:nth-child(3) {
      left: -50px;
      width: 110%;
      height: 100%;
      background-color: fade(@snow, 40%);
      transform: scaleX(-1);
    }
  }
}



//////////////////////////////
//  X M A S S    T R E E
//////////////////////////////

.xmass-tree {
  position: absolute;
  bottom: 20%;
  right: 20%;
  width: 350px;
  height: 450px;
  /* outline: 1px dotted yellow; */
  
  &__bottom,
  &__middle,
  &__top {
    position: absolute;
    background-color: @green;
    border-radius: 50% 50% 50% 50% ~"/" 70% 70% 30% 30%;
    box-shadow:
      inset -10px 15px 0 snow,
      inset 10px -10px 0 darken(@green, 5%);
  }
  
  &__bottom {
    bottom: 0;
    width: 350px;
    height: 225px;
  }
  
  &__middle {
    bottom: 190px;
    left: 50px;
    width: 250px;
    height: 150px;
    animation: sway-middle 10s infinite ease-in-out;
  }
  
  &__top {
    bottom: 320px;
    bottom: 310px;
    left: 115px;
    width: 100px;
    height: 120px;
    animation: sway-top 10s infinite ease-in-out;
  }
}



//////////////////////////////
//  S N O W M A N
//////////////////////////////

.snowman {
  position: absolute;
  bottom: 15%;
  left: 20%;
  width: 200px;
  height: 400px;
  /* outline: 1px dotted yellow; */
  
  &__snowball {
    position: absolute;
    background-color: snow;
    border-radius: 50%;
    box-shadow: inset 10px -10px 0 lighten(@blue, 80%);
    
    &:first-child {
      bottom: 0;
      width: 200px;
      height: 180px;
    }
    &:nth-child(2) {
      bottom: 130px;
      left: 15px;
      width: 160px;
      height: 145px;
    }
    &:nth-child(3) {
      bottom: 240px;
      left: 45px;
      width: 120px;
      height: 110px;
    }
  }
}

.button {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 300px;
  height: 300px;
  background-color: @red;
  border-radius: 50%;
  box-shadow:
    inset -25px 25px 0 lighten(@red, 15%),
    inset 25px -25px 0 darken(@red, 15%),
    inset 0 0 0 50px darken(@red, 5%);

  &::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow:
      -40px -40px 0 @snow,
      40px -40px 0 @snow,
      40px 40px 0 @snow,
      -40px 40px 0 @snow;
    transform: translate(-50%, -50%);
  }
  
  &--bottom:first-child {
    top: -90px;
    left: -10px;
    transform: scale(.11) rotate(160deg);
  }
  &--bottom:last-child {
    top: -40px;
    left: 0;
    transform: scale(.11) rotate(15deg);
  }
  
  &--torso:first-child {
    top: -100px;
    left: -35px;
    transform: scale(.1) rotate(50deg);
  }
  &--torso:nth-child(2) {
    top: -60px;
    left: -25px;
    transform: scale(.1) rotate(200deg);
  }
  
  &--head:first-child {
    top: -100px;
    left: -95px;
    transform: scale(.1) rotate(10deg);
  }
  &--head:nth-child(2) {
    top: -110px;
    left: -55px;
    transform: scale(.08) rotate(40deg);
  }
}

.carrot {
  position: absolute;
  top: 60px;
  left: 73px;
  width: 40px;
  height: 20px;
  background-color: @orange;
  border-radius: 20% 75% 75% 20% ~"/" 50% 50% 50% 50%;
  box-shadow: inset 0 -5px 0 darken(@orange, 10%);
  transform: rotate(30deg);
}

.stick {
  position: absolute;
  width: 120px;
  height: 10px;
  background-color: @brown;
  border-radius: 0 5px 5px 50%;
  box-shadow: inset 0 3px 0 lighten(@brown, 5%);
  transform-origin: top right;
  /* outline: 1px dotted yellow; */
  
  &--left {
    top: 50px;
    left: -80px;
    transform: rotate(-10deg);
    animation: wave-left-hand 5s 5s infinite ease-in-out;
  }
  
  &--right {
    top: 35px;
    right: 10px;
    width: 100px;
    box-shadow: inset 0 -3px 0 lighten(@brown, 5%);
    transform: rotate(140deg);
    animation: wave-right-hand 5s 5s infinite ease-in-out;
  }
  
  &::after {
    content: "";
    position: absolute;
    // 15px - magic number
    top: calc(50% - 15px);
    width: 40px;
    height: 40px;
    border-top: 5px solid @brown;
    border-right: 5px solid @brown;
    border-radius: 5px 20px;
    transform-origin: top right;
    transform: rotate(45deg);
  }
}



//////////////////////////////
//  S N O W F L A K E
//////////////////////////////

.snowflake {
  position: absolute;
  top: 20px;
  left: 20px;
  // range: 75px - 300px and more
  width: 300px;
  // range: 75px - 300px and more
  height: 300px;
  filter: drop-shadow(0 0 5px @snow);
  /* outline: 1px dotted yellow; */
  
  &--big {
    width: 300px;
    height: 300px;
  }
  
  &--medium {
    width: 75px;
    height: 75px;
  }
  
  &--small {
    width: 80px;
    height: 80px;
    transform: scale(.3);
  }
  
  &--air {
    top: 0;
    left: 60%;
    animation: fall 10s ease-in-out infinite;
  }
  
  &--tree {
    top: 45px;
    right: 45px;
    left: auto;
    transform: rotate(20deg);
    
    &:hover {
      animation: spin 10s;
    }
  }
  
  &__ray {
    position: absolute;
    top: calc(50% - 2.5%);
    width: 100%;
    height: 5%;
    background-color: @snow;
    border-radius: 50%;
    
    &:first-child {
      transform: rotate(90deg);
    } 
    &:nth-child(2) {
      transform: rotate(150deg);
    }
    &:nth-child(3) {
      transform: rotate(210deg);
    }
    
    &::before,
    &::after {
      content: "";
      position: absolute;
      // magic number
      top: 45%;
      width: 20%;
      // magic number
      height: 400%;
      border-left: 3px solid @snow;
      border-top: 3px solid @snow;
      border-radius: 25%;
      filter: drop-shadow(10px 10px 0 @snow);
    }
    &::before {
      left: 20%;
      transform-origin: top left;
      transform: rotate(135deg);
    }
    &::after {
      // magic number
      right: 0%;
      transform-origin: top left;
      transform: rotate(315deg);
    }
  }
  
  &__center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25%;
    // magic number
    height: 25%;
    background-color: @snow;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    clip-path: polygon(
      0% 33%,
      50% 0%,
      100% 33%,
      100% 66%,
      50% 100%,
      0% 66%,
      
      10% 66%,
      50% 90%,
      90% 66%,
      90% 33%,
      50% 10%,
      10% 33%,
      10% 66%,
      0% 66%,
      0% 33%
    );
  }
}



//////////////////////////////
//  A N I M A T I O N
//////////////////////////////

@keyframes shine {
  0% { filter: none; }
  33% { filter: drop-shadow(0 0 5px @snow); }
  66% { filter: drop-shadow(0 0 5px @snow); }
  100% { filter: none; }
}

@keyframes sway-middle {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform-origin: right;
    transform: rotate(-5deg) translate(-10%, -5%);
  }
  50% {
    transform-origin: left;
    transform: rotate(5deg)  translate(5%, -5%);
  }
  75% {
    transform-origin: center;
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes sway-top {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform-origin: right;
    transform: rotate(-10deg) translate(-40%, -5%);
  }
  50% {
    transform-origin: left;
    transform: rotate(10deg) translate(35%, 0%);
  }
  75% {
    transform-origin: center;
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes wave-left-hand {
  0% { transform: rotate(-10deg); }
  25% { transform: rotate(10deg); }
  50% { transform: rotate(-30deg); }
  75% { transform: rotate(-10deg); }
  100% { transform: rotate(-10deg); }
}

@keyframes wave-right-hand {
  0% { transform: rotate(140deg); }
  25% { transform: rotate(130deg); }
  50% { transform: rotate(150deg); }
  75% { transform: rotate(140deg); }
  100% { transform: rotate(140deg); }
}

@keyframes fall {
  0% {
    transform: translate(0, -100%) scale(.3);
  }
  20% {
    transform: translate(100px, 50px) scale(.3);
  }
  40% {
    transform: translate(-100px, 200px) scale(.3);
  }
  60% {
    opacity: 1;
    transform: translate(100px, 350px) scale(.3);
  }
  80% {
    transform: translate(-100px, 550px) scale(.3);
  }
  100% {
    opacity: 0;
    transform: translate(100px, 700px) scale(.3);
  }
}

@keyframes spin {
  5% {
    filter: none;
  }
  100% {
    transform: rotate(380deg);
    filter: none;
  }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console