Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

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.

+ add another resource

Behavior

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              %div.clock-container
  %div.clock
    %div.block-new-year 
      Countdown to New Year 
      %div.block-year
    %div.block-days 
      %div 000
      %div.clock-label Days
    %div.block-seperator
    %div.block-hour 
      %div 00
      %div.clock-label Hours
    %div.block-seperator
    %div.block-minute 
      %div 00
      %div.clock-label Minutes
    %div.block-seperator
    %div.block-second 
      %div 00
      %div.clock-label Seconds
    %div.block-emoji 🎉🎇🎇🎊
    
    %div.stars.stars-1
    %div.stars.stars-2
    %div.stars.stars-3

    %div.firework-container
      -10.times do
        %div.firework
          -40.times do
            %div.c
            
          
!

CSS

            
              html
  height: 100%
  overflow: hidden
  
body
  background: linear-gradient(to bottom, #060035, #03001b) no-repeat #03001b
  margin: 0
  font-family: 'Roboto Mono', monospace
  height: 100%
  overflow: hidden

.clock-container
  display: flex
  
.clock
  margin: 10% auto
  line-height: 1
  // background: black
  color: #fff
  display: flex
  align-items: baseline
  justify-content: center
  position: relative
  padding: 40px 20px
  flex-wrap: wrap
  // overflow: hidden

.clock-label
  text-align: center
  font-size: 25px
  
.block-days,  
.block-hour,
.block-minute,
.block-second
  background: rgba(255,255,255,.2)
  padding-left: 7px
  padding-right: 7px
  padding-bottom: 10px
  
.block-new-year 
  font-size: 25px
  
.block-year
  font-size: 100px
  margin-bottom: 50px
    
.block-days,  
.block-hour,
.block-minute
  font-size: 125px
    
.block-second
  font-size: 100px
  padding-top: 20px
  
  div:first-child
    line-height: 105px
  
.block-seperator
  width: 10px

.block-new-year,
.block-emoji
  flex-basis: 100%
  text-align: center
  
.block-emoji
  margin-top: 50px
  font-size: 100px
  
/** STARS **/
// n is number of stars required
@function multiple-box-shadow ($n) 
  $value: '#{random(2000)}px #{random(2000)}px #FFF'
  @for $i from 2 through $n
    $value: '#{$value} , #{random(2000)}px #{random(2000)}px #FFF'

  @return unquote($value)
  
$shadows-small:  multiple-box-shadow(700)
$shadows-medium: multiple-box-shadow(200)
$shadows-big:    multiple-box-shadow(100)

.stars
  position: absolute
  left: 0
  
.stars-1
  width: 1px
  height: 1px
  background: transparent
  box-shadow: $shadows-small
  animation			: animStar 50s linear infinite
    
  &:after
    content: " "
    position: absolute
    top: 2000px
    width: 1px
    height: 1px
    background: transparent
    box-shadow: $shadows-small
    
.stars-2
  width: 2px
  height: 2px
  background: transparent
  box-shadow: $shadows-medium
  animation			: animStar 100s linear infinite
    
  &:after
    content: " "
    position: absolute
    top: 2000px
    width: 2px
    height: 2px
    background: transparent
    box-shadow: $shadows-medium
    
.stars-3
  width: 3px
  height: 3px
  background: transparent
  box-shadow: $shadows-big
  animation			: animStar 150s linear infinite
    
  &:after
    content: " "
    position: absolute
    top: 2000px
    width: 3px
    height: 3px
    background: transparent
    box-shadow: $shadows-big
  
@keyframes animStar
  from	
    transform: translateY(0px)
  to		
    transform: translateY(-2000px)
/** STARS END **/

/** FIREWORKS **/
@function posOrNeg()
  @return random() * 2 - 1

$fwSize: 5
$totalFireworks: 10
$totalPieces: 40
$time: 5

.firework-container 
  height: 100%
  transform-style: preserve-3d
  position: absolute
  bottom: -25%

.firework 
  position: absolute
  top: 105%
  left: 50%
  opacity: 0
  backface-visibilty: hidden

.c 
  background: white
  height: $fwSize+px
  width: $fwSize+px
  position: absolute
  border-radius: 50%


@for $i from 1 through $totalFireworks 
  $x: random(300) * posOrNeg()+px
  $y: -(random(30) + 60)+vh
  
  @keyframes shoot#{$i}
    0% 
      transform: translate3d(0,0,0) scale(.1)
    95% 
      opacity: 1
    100% 
      transform: translate3d($x, $y, 0) scale(1)
      opacity: 0
  
  .firework:nth-child(#{$i})
    animation: shoot#{$i} $time+s infinite
    animation-delay: ($time/$totalFireworks * $i)+s
  

  @for $x from 1 through $totalPieces 
    .firework:nth-child(#{$i}) .c 
      $hue: (360/$totalFireworks) * $i
      background: hsl($hue, 100%, 50%)
      box-shadow: 0 0 3px 0px hsla($hue, 100%, 50%, .8)
      &:nth-child(#{$x})
        animation-delay: ($time/$totalFireworks * $i)+s

@for $x from 1 through $totalPieces 
  @keyframes explode#{$x} 
    60% 
      transform: translate3d(0,0,0) scale(1)
    100% 
      transform: translate3d(random(150) * posOrNeg()+px, random(150) * posOrNeg()+px, 0) scale(.1)
    
  .c:nth-child(#{$x}) 
    animation: explode#{$x} $time+s infinite linear
/** FIREWORKS END **/
            
          
!

JS

            
              const countdownDate = new Date(new Date().getFullYear() + 1, 0, 1);
const countdownTime = countdownDate.getTime();

let distance = countdownTime - new Date().getTime();

const yearElem = document.querySelector(".block-year");
const daysElem = document.querySelector(".block-days");
const hourElem = document.querySelector(".block-hour");
const minuteElem = document.querySelector(".block-minute");
const secondElem = document.querySelector(".block-second");

yearElem.innerText = countdownDate.getFullYear();

function padString(value, padding = 2) {
  return String(value).padStart(padding,0);
};

function changeText(elem, value) {
  elem.querySelector("div").innerText = value;
}

setInterval(function () {
  const distance = countdownTime - new Date().getTime();
  
  const day = 1000 * 60 * 60 * 24;
  const hour = 1000 * 60 * 60;
  const minute = 1000 * 60;
  const second = 1000;
  
  changeText(daysElem, padString(Math.floor(distance / day), 3));
  changeText(hourElem, padString(Math.floor((distance % day) / hour)));
  changeText(minuteElem, padString(Math.floor((distance % hour) / minute)));
  changeText(secondElem, padString(Math.floor((distance % minute) / 1000)));
}, 1000)
            
          
!
999px

Console