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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                <!--
Inspired by this dribble:
http://dribbble.com/shots/795656-Mask-watch-concept

This works in Chrome and Firefix, not yet in Opera.

And fuck IE.
-->

<div id="watch">
  <div id="hours"><span></span></div>
  <div id="minutes"><span></span></div>
  <div id="seconds"><span></span></div>
  <div id="overlay"><span>CSS CLOCK</span></div>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Fredoka+One);

body {
  background: #ddd;
  font-family: 'Fredoka One', cursive;
}

#watch {
  background: linear-gradient(top, rgba(0,0,0,.2) 0%, rgba(0,0,0,.5) 100%);
  width: 300px;
  height: 300px;
  border-radius: 50%;
  position: absolute;
  top: 40px;
  left: 50%;
  margin-left: -150px;
  box-shadow:
    0 -2px 10px rgba(0,0,0,.2),
    0 0 0 20px white,
    0 0 10px 20px rgba(0,0,0,.2);
}
#hours,
#minutes,
#seconds {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%; 
  border-radius: 50%;
  background-position: 50% 50%;
  background-repeat: no-repeat
}
#hours span,
#minutes span,
#seconds span {
  display: block;
  width: 100%;
  height: 100%; 
  background-image: url(http://img.dreamdealer.nl/dd/clock_mask.png);
  background-size: cover;
  background-position: 50% 50%;
  border-radius: 50%;
  animation-delay: 0s;
  box-shadow: 0 0 1px 1px rgba(0,0,0,.2);
}
#hours {
  background-image: url(http://img.dreamdealer.nl/dd/numbers_hours.png);
  background-size: 280px 280px;
}
#minutes {
  width: 231px;
  height: 231px;
  left: 35px;
  top: 35px;
  background-image: url(http://img.dreamdealer.nl/dd/numbers_seconds.png);
  background-size: 214px 214px;
}
#seconds {
  width: 177px;
  height: 177px;
  left: 62px;
  top: 62px;
  background-image: url(http://img.dreamdealer.nl/dd/numbers_seconds.png);
  background-size: 165px 165px;
}
#hours span {
  background-image: url(http://img.dreamdealer.nl/dd/clock_mask_hour.png);
  animation: linear rotateClock 43200s infinite;
}
#minutes span {
  animation: linear rotateClock 3600s infinite;
}
#seconds span {
  animation: linear rotateClock 60s infinite;
}


@keyframes rotateClock {
  0% { transform: rotate(-1deg); }
  100% { transform: rotate(359deg); }
}
#overlay {
  background: linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,.1) 100%);
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0; top: 0;
  border-radius: 50%;
  box-shadow:
    0 2px 0 rgba(0,0,0,.3) inset,
    0 8px 0 rgba(0,0,0,.1) inset,
    0 -3px 0 rgba(0,0,0,.05) inset; 
}
#overlay span {
  background: white linear-gradient(top, transparent 0%, rgba(0,0,0,.15) 100%);
  display: block;
  position: absolute;
  width: 135px;
  height: 135px;
  left: 83px; top: 83px;
  border-radius: 50%;
  text-align: center;
  line-height: 135px;
  font-size: 18px;  
  color: #888;
  text-shadow:
    0 -1px #555, 0 1px #FFF;  
  box-shadow:
    0 0 6px rgba(0,0,0,.12) inset,
    0 3px 0 rgba(0,0,0,.05) inset; 
}
              
            
!

JS

              
                /*

This JS sets the animation delay time to a negative value. This skips the animation ahead in time. This is to set the dials to the right time, because otherwise the clock would always start at 00:00:00

*/
$(document).ready(function(){
  var d = new Date();
  var h = d.getHours();
  if (h > 12) { h -= 12; }
  var m = d.getMinutes();
  var s = d.getSeconds();
  $('#hours span').css('webkitAnimationDelay','-'+((h*3600)+(m*60))+'s').css('animationDelay','-'+((h*3600)+(m*60))+'s');
  $('#minutes span').css('webkitAnimationDelay','-'+((m*60)+s)+'s').css('animationDelay','-'+((m*60)+s)+'s');
  $('#seconds span').css('webkitAnimationDelay','-'+(s)+'s').css('animationDelay','-'+(s)+'s');
});
              
            
!
999px

Console