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 includes JSX processing.

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

Packages

Add Packages

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.

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

              
                .clock
  .dial
    .hour
    .minute
    .second
              
            
!

CSS

              
                $backgroundColor: #f3fafe
$clockColor: #0485d5
$dialColor: #0ea7fa
$indicatorColor: #63c7ff
$hourMinuteHandColor: #084870
$secondHandColor: #f65148

body
  background-color: $backgroundColor

.clock
  position: absolute
  top: 50%
  left: 50%
  margin-left: -141px
  margin-top: -141px
  width: 250px
  height: 250px
  background-color: $dialColor
  border: 16px solid $clockColor
  border-radius: 50%
  box-shadow: 0 0 8px 0 transparentize(#000000, 0.5)

  &:before, &:after
    content: ""
    position: absolute
    top: 10px
    left: 50%
    margin-left: -7px
    height: 30px
    width: 14px
    background-color: $indicatorColor
    box-shadow: 0 200px $indicatorColor

  &:after
    left: 10px
    top: 50%
    margin-left: 0
    margin-top: -7px
    height: 14px
    width: 30px
    box-shadow: 200px 0 $indicatorColor
  
.dial
  height: 100%
  width: 100%
  box-shadow: 0px -1px 1px 0 transparentize(#ffffff, 0.3)
  border-radius: 50%
  
  &:before, &:after
    content: ""
    position: absolute
    top: 15px
    left: 50%
    margin-left: -7px
    width: 14px
    height: 14px
    background-color: $indicatorColor
    box-shadow: 103px 103px $indicatorColor, -103px 103px $indicatorColor, 0 206px $indicatorColor
    z-index: 2
    transform-origin: 7px 110px
    transform: rotate(30deg)
  
  &:after
    transform: rotate(60deg)
  
.hour, .minute, .second
  width: 94px
  height: 8px
  background-color: $hourMinuteHandColor
  position: absolute
  top: 50%
  margin-top: -4px
  left: 50%
  margin-left: -20px
  transform-origin: 20px 4px
  z-index: 2
  box-shadow: 1px 1px 1px transparentize(#000000, 0.8)
  animation: ticktock 12*60*60s steps(60) -9*60*60s infinite
  
.minute
  width: 104px
  height: 6px
  margin-left: -24px
  margin-top: -3px
  transform-origin: 24px 3px
  box-shadow: 1px 1px 2px transparentize(#000000, 0.8)
  animation: ticktock 60*60s steps(60) -45*60s infinite
  
  &:after
    content: ""
    position: absolute
    top: -4px
    left: 17px
    width: 14px
    height: 14px
    background-color: inherit
    border-radius: 50%
  
.second
  background-color: $secondHandColor
  width: 120px
  margin-left: -30px
  height: 4px
  margin-top: -2px
  transform-origin: 30px 2px
  box-shadow: 1px 1px 3px transparentize(#000000, 0.8)
  animation: ticktock 60s steps(60) -45s infinite
  
  &:before
    content: ""
    position: absolute
    width: 30px
    height: 6px
    margin-top: -1px
    background-color: inherit
  
  &:after
    content: ""
    position: absolute
    width: 6px
    height: 6px
    left: 26px
    top: -3px
    background-color: $hourMinuteHandColor
    border: 2px solid $secondHandColor
    border-radius: 50%
  
  
@keyframes ticktock
  100%
    transform: rotate(360deg)
  
              
            
!

JS

              
                // Inspired by https://dribbble.com/shots/2374281-Watchface-Material-icon

let dateTime = new Date();
let hour     = dateTime.getHours();
let minute   = dateTime.getMinutes();
let second   = dateTime.getSeconds();

let hourElement   = document.getElementsByClassName('hour')[0];
let minuteElement = document.getElementsByClassName('minute')[0];
let secondElement = document.getElementsByClassName('second')[0];

hourElement.style.animationDelay   = `-${(9+hour)*60*60}s`;
minuteElement.style.animationDelay = `-${(45+minute)*60}s`;
secondElement.style.animationDelay = `-${(45+second)}s`;

              
            
!
999px

Console