cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

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.

            
              div#app
  
  div.bus
    .windows
    .lights
    .street
    
  countdown
  
  
            
          
!
            
              // FONTS
@import url('https://fonts.googleapis.com/css?family=Graduate|Quicksand:300,400,700');
$main-font: 'Quicksand', sans-serif;
$num-family: 'Graduate', sans-serif;

// COLORS
$white: #fff;
$black: #000;
//https://coolors.co/app/ffcdb2-ffb4a2-e5989b-b5838d-6d6875
$palette: #FFCDB2, #FFB4A2, #E5989B, #B5838D, #6D6875;


// GENERAL
*, *::before, *::after{
  box-sizing: border-box;
}
body{
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: $main-font;
  font-size: 16px;
  background: nth($palette, 1);
}


// COUNTDOWN STYLES
.countdown{
  text-align: center;
}
.timer{
  perspective: 1000px;
  .box{
    display: inline-block;
    margin: 1rem;
    width: 10rem;
    text-align: center;
    background: nth($palette, 3);
    //needed for firestorm
    -moz-transform-style: preserve-3d; 
    &:nth-child(2) .value{
      animation-delay: 1s;

    }
    &:nth-child(3) .value{
      animation-delay: 1.8s;

    }
    &:nth-child(4) .value{
      animation-delay: 1.3s;

    }
    &:nth-child(5) .value{
      animation-delay: 2s;

    }
    .spacer{
      position: relative;
      content: '';
      display: block;
      height: 20px;
      background: nth($palette, 2);
      &::before, &::after{
        content: '';
        position: absolute;
        top: 5px;
        width: 10px;
        height: 10px;
        background: nth($palette, 1);
        border-radius: 50%;
      }
      &::before{
        left: .8rem;
      }
      &::after{
        right: .8rem;
      }
    }
    .value{
      position: relative;
      margin: 0;
      padding: 1.2rem 0 2rem;
      font-family: $num-family;
      font-size: 3em;
      color: rgba(nth($palette, 5), .6);
      background: nth($palette, 2);
      transform-origin: top center;
      animation: wind 4s ease-out alternate infinite;
      box-shadow: 0 15px 10px -10px rgba(nth($palette, 4), 0);
    }
    .label{
      margin: 0;
      padding: 1rem;
      color: rgba($white, .8);
      background: nth($palette, 3);
      &::first-letter{
        text-transform: uppercase;
      }
    }
  }
  .text{
    margin-top: 2rem;
    font-weight: 300;
    font-size: 1.25em;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    color: nth($palette, 4);
  }
}
.expired-timer{
  .box{
    width: 100%;
  }
}


// DRAWING
.bus{
  transform: scale(.8);
  position: relative;
  width: 120px;
  height: 100px;
  margin: 3rem auto 4rem;
  border-radius: 30px 30px 0 0;
  background: nth($palette, 5);
  &::before, &::after{
    content: '';
    position: absolute;
    top: 100%;
    width: 20px;
    height: 20px;
    border-radius: 0 0 2px 2px;
    background: nth($palette, 5);
  }
  &::before{
    left: .5rem;
  }
  &::after{
    right: .5rem;
  }
  .windows{
    position: absolute;
    top: 20px;
    left: 0.5rem;
    right: 0.5rem;
    height: 35px;
    &::before, &::after{
      content: '';
      position: absolute;
      top: 0;
      width: 48%;
      height: 100%;
      background: rgba($white, .7);
    }
    &::before{
      left: 0;
    }
    &::after{
      right: 0;
    }
  }
  .lights{
    position: absolute;
    bottom: 10px;
    left: .5rem;
    right: .5rem;
    height: 10px;
    &::before, &::after{
      content: '';
      position: absolute;
      top: 0;
      width: 10px;
      height: 10px;
      background: nth($palette, 2);
      border-radius: 50%;
    }
    &::before{
      left: 16px;
      box-shadow: -16px 0 0 2px rgba($white, .5),
                  14px 0 0 nth($palette, 3);
      animation: lighting 6s 2s linear infinite;
    }
    &::after{
      right: 16px;
      box-shadow: 16px 0 0 2px rgba($white, .5),
                  -14px 0 0 nth($palette, 3);
      animation: lighting2 6s 2s linear infinite;
    }
  }
  .street{
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 1px;
    background: rgba(nth($palette, 4), .8);
    &::before, &::after{
      content: '';
      position: absolute;
      height: 1px;
      left: 50%;
      transform: translateX(-50%);
    }
    &::before{
      top: 10px;
      width: 110px;
      background: rgba(nth($palette, 4), .6);
    }
    &::after{
      top: 20px;
      width: 90px;
      background: rgba(nth($palette, 4), .4);
    }
  }
}


// ANIMATIONS
@keyframes wind{
  0%{
    transform: rotatex(0);
    box-shadow: 0 15px 10px -10px rgba(nth($palette, 4), 0);
    color: rgba(nth($palette, 5), .6);
    background: nth($palette, 2);
  }
  10%{
    transform: rotatex(20deg);
    box-shadow: 0 15px 10px -10px darken(nth($palette, 4), 5%);
    color: rgba(nth($palette, 5), .45);
    background: lighten(nth($palette, 2), 3%);
  }
}
@keyframes lighting{
  0%{
    box-shadow: -16px 0 0 2px rgba($white, .5),
                  14px 0 0 nth($palette, 3);
  }
  4%{
    box-shadow: -16px 0 0 2px rgba($white, 1),
                  14px 0 0 nth($palette, 3);
  }
  8%{
    box-shadow: -16px 0 0 2px rgba($white, .5),
                  14px 0 0 nth($palette, 3);
  }
  12%{
    box-shadow: -16px 0 0 2px rgba($white, 1),
                  14px 0 0 nth($palette, 3);
  }
  20%{
    box-shadow: -16px 0 0 2px rgba($white, 1),
                  14px 0 0 nth($palette, 3);
  }
  22%{
    box-shadow: -16px 0 0 2px rgba($white, .5),
                  14px 0 0 nth($palette, 3);
  }
}
@keyframes lighting2{
  0%{
    box-shadow: 16px 0 0 2px rgba($white, .5),
                  -14px 0 0 nth($palette, 3);
  }
  4%{
    box-shadow: 16px 0 0 2px rgba($white, 1),
                  -14px 0 0 nth($palette, 3);
  }
  8%{
    box-shadow: 16px 0 0 2px rgba($white, .5),
                  -14px 0 0 nth($palette, 3);
  }
  12%{
    box-shadow: 16px 0 0 2px rgba($white, 1),
                  -14px 0 0 nth($palette, 3);
  }
  20%{
    box-shadow: 16px 0 0 2px rgba($white, 1),
                  -14px 0 0 nth($palette, 3);
  }
  22%{
    box-shadow: 16px 0 0 2px rgba($white, .5),
                  -14px 0 0 nth($palette, 3);
  }
}


// RESPONSIVE
@media screen and (max-width: 800px){
  .countdown{
    width: 100%;
    max-width: 25rem;
  }
}
@media screen and (max-width: 480px){
  .timer{
    .box{
      margin: 1rem .5rem;
      width: 8rem;
    }
  }
  .expired-timer{
    .box{
      width: 18rem;
    }
  }
}
            
          
!
            
              /**************************
  COUNTDOWN COMPONENT
 **************************/
Vue.component('countdown', {
  template: `
  <section class="countdown">
    
    <div v-show="!expired" class="timer">
      <div class="box">
        <div class="spacer"></div>
        <p class="value">{{ theTime.days }}</p>
        <p class="label">days</p>
      </div>
      <div class="box">
        <div class="spacer"></div>
        <p class="value">{{ theTime.hours }}</p>
        <p class="label">hours</p>
      </div>
      <div class="box">
        <div class="spacer"></div>
        <p class="value">{{ theTime.minutes }}</p>
        <p class="label">minutes</p>
      </div>
      <div class="box">
        <div class="spacer"></div>
        <p class="value">{{ theTime.seconds }}</p>
        <p class="label">seconds</p>
      </div>
      <p class="text">to meet you</p>
    </div>

    <div v-show="expired" class="expired-timer timer">
      <div class="box">
        <div class="spacer"></div>
        <p class="value">It's the great day</p>
        <p class="label">I'll have you in my arms</p>
      </div>
    </div>
   
  </section>
`,
  
 data() {
   return{
     deadline: 'Dec 25, 2018 20:45:00',
     days: 'HI',
     hours: 'TH',
     minutes: 'ER',
     seconds: 'E!',
     expired: false 
   };
 },
  
 computed: {
   theTime(){
     var ctx = this;
         
     // Countdown loop    
     var x =  setInterval(function(){
       
       // Difference between the 2 dates
       var countDownDate = new Date(ctx.deadline).getTime(),
           now = new Date().getTime(),
           diff = countDownDate - now,

           // Time conversion to days, hours, minutes and seconds
           tdays = Math.floor(diff / (1000 * 60 * 60 * 24)),
           thours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)),
           tminutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)),
           tseconds = Math.floor((diff % (1000 * 60)) / 1000);
       
       // Keep 2 digits
       ctx.days = (tdays < 10) ? '0' + tdays : tdays;
       ctx.hours = (thours < 10) ? '0' + thours : thours;
       ctx.minutes = (tminutes < 10) ? '0' + tminutes : tminutes;
       ctx.seconds = (tseconds < 10) ? '0' + tseconds : tseconds;

       // Check for time expiration
       if(diff < 0){
         clearInterval(x);
         ctx.expired = true;
       }
     }, 1000);
     
     // Return data
     return {
       days: ctx.days,
       hours: ctx.hours,
       minutes: ctx.minutes,
       seconds: ctx.seconds
     };
   }
 }
});



/**************************
  ROOT COMPONENT
 **************************/
var app = new Vue({
  el: '#app'
});
            
          
!
999px
Loading ..................

Console