Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                
<div class="watch-crown"></div>
<div class="watch">
  <div id="cssclock">
    <div id="clockanalog">
      <div class="watch-center-circle"></div>
      <div class="watch-hand-second"  id="analogsecond"></div>
     <div class="watch-hand-minute"  id="analogminute"></div>
      <div class="watch-hand-hour"  id="analoghour"></div>
    </div>

  <div class="watch-face">
    <ul>
      <li>12</li>
      <li>3</li>
      <li>6</li> 
      <li>9</li>
    </ul>
  </div>
</div>
  
  <div class="watch-strap"></div>
              
            
!

CSS

              
                @import "compass/css3";

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

html {
  background: #2980b9; 
}



$watch-color: #34495e;


.watch {
  background: $watch-color;
  border-radius: 50%;
  height: 20em;
  left: 50%;
  margin-left: -10em;
  margin-top: -10em;
  position: absolute;
  top: 50%;
  width: 20em; 
  
  &:after, &:before {
    content: '';
    background-color: #bfbfbf;
    @include filter-gradient(#bfbfbf, #ecf0f1, vertical);
    @include background-image(linear-gradient(top,  #bfbfbf 0%,#ecf0f1 100%));
    border-radius: 50%;
    position: absolute;
    height: 22em;
    left: -1em;
    top: -1em;
    width: 22em;
    z-index: -1; 
  }
  
  &:before {
    box-shadow: -0.2em -0.4em 0.5em rgba(black,0.2);
    height: 24em;
    left: -2em;
    transform: rotate(180deg);
    top: -2em;
    width: 24em; 
  }
}

.watch-face {
  border-radius: 50%;
  height: 100%;
  width: 100%;
  
  ul {
    list-style: none;
    
    li {
      background: $watch-color; 
      border-radius: 50%;
      color: #ecf0f1;
      font-size: 2.8em;
      height: 1.5em;
      line-height: 1.5;
      position: absolute;
      text-align: center;
      text-shadow: 0.05em 0.05em 0.1em rgba(black,0.3);
      width: 1.5em; 
      
      &:first-child {
        top: 0;
        left: 50%;
        margin-left: -0.75em;
      }
      
      &:nth-child(2) {
        margin-top: -0.75em;
        right: 0; 
        top: 50%;
      }
      
      &:nth-child(3) {
        bottom: 0;
        left: 50%;
        margin-left: -0.75em;
      }
      &:nth-child(4) {
        margin-top: -0.75em;
        left: 0; 
        top: 50%;
      }      
      
    }
  }
  
  &:after {
    content: '';
    @include background-image(linear-gradient(left bottom,  rgba(255,255,255,0) 0%,rgba(255,255,255,0) 60%,rgba(255,255,255,0.1) 60%));
    box-shadow: inset 0.5em 1em 2em rgba(black,0.3),inset -0.5em -1em 2em rgba(white,0.1);
    border-radius: 50%;
    position: absolute;
    height: 20em;
    left: 0;
    top: 0;
    width: 20em;
    z-index: 5;
  }
  
  &:before {
    border-radius: 50%;
    border: 0.25em solid #ecf0f1;
    box-shadow: 
      0.05em 0.05em 0.1em rgba(black,0.9),
      inset 0.05em 0.05em 0.1em rgba(white,0.3),
      inset -0.05em -0.05em 0.1em rgba(black,0.9),
      -0.05em -0.05em 0.1em rgba(white,0.3);
    content: '';
    height: 80%;
    left: 9.5%; 
    position: absolute;
    top: 9.5%;
    width: 80%;
  }
  
}
.watch-crown {
  background-color: gray;
  background-image: linear-gradient(transparent 50%, rgba(255,255,255,.5) 50%);
  background-size: 6px 6px; 
  border-radius: 0.2em;
  height: 2em;
  left: 50%;
  margin-left: 12em;
  margin-top: -1em;
  position: absolute;
  top: 50%;
  width: 1em; 
}


.watch-strap {
  background-color: #282828;
  border-left: 0.2em dashed rgba(white,0.2);
  border-right: 0.2em dashed rgba(white,0.2);
  box-shadow: 
    -0.3em 0 #282828,
    0.3em 0 #282828,
    -0.4em -0.6em 0.5em rgba(black,0.2),
    0.4em 0.6em 0.5em rgba(black,0.2);
  height: 100%;
  margin-left: -6em;
  left: 50%;
  position: fixed;
  top: 0;
  width: 12em;
  z-index: -3;
}

[class*="watch-hand"] {
  background: #bfbfbf;
  border-radius: 0.4em 0.4em 0 0;
  box-shadow: 0 0 0.5em rgba(black,0.2);
  left: 9.8em;
  position: absolute;
  top: 2em;
  z-index: 4;
  transform-origin: 50% 100%  ; 
}

.watch-hand-second {
  width: 0.2em;
  top: 0.1em;
  height: 10em; 
}

.watch-hand-minute {
  width: 0.4em;
  top: 2.1em;
  height: 8em; 
}

.watch-hand-hour {
  width: 0.6em;
  top: 4em;
  height: 6em; 
}
.watch-center-circle {
  background: #ecf0f1;
  box-shadow: 0 0 0.1em rgba(black,0.4);
  border-radius: 50%;
  height: 1.5em;
  left: 50%;
  margin-left: -0.75em;
  margin-top: -0.75em;
  position: absolute;
  top: 50%;
  width: 1.5em; 
  z-index: 5;
  
  &:after {
    background: #7f8c8d;
    border-radius: 50%;
   content: '';
    height: 0.9em;
    left: 0.3em;
    position: absolute;
    top: 0.3em;
    width: 0.9em;
  }
}
              
            
!

JS

              
                /* I didn't write the JS, the script is from here:
*  http://joncom.be/code/css-clocks/
*/
var oClockAnalog = {
    aSecond:         [],
    dtDate:          new Date(),
    iCurrSecond:     -1,
    iHourRotation:   -1,
    iMinuteRotation: -1,
    iStepSize:       10,
    iTimerAnimate:   setInterval("oClockAnalog.fAnimate()", 20),
    iTimerUpdate:    setInterval("oClockAnalog.fUpdate()", 1000),

    fAnimate:       function() {
        if (this.aSecond.length > 0) {
            this.fRotate("analogsecond", this.aSecond[0]);
            this.aSecond = this.aSecond.slice(1);
        }
    },
    fGetHour:     function() {
        var iHours = this.dtDate.getHours();
        if (iHours > 11) {
            iHours -= 12;
        }
        return Math.round((this.dtDate.getHours() * 30) + (this.dtDate.getMinutes() / 2) + (this.dtDate.getSeconds() / 120));
    },
    fGetMinute:     function() {
        return Math.round((this.dtDate.getMinutes() * 6) + (this.dtDate.getSeconds() / 10));
    },
    fInit:          function() {
        this.iHourRotation = this.fGetHour();
        this.fRotate("analoghour", this.iHourRotation);

        this.iMinuteRotation = this.fGetMinute();
        this.fRotate("analogminute", this.iMinuteRotation);

        this.iCurrSecond = this.dtDate.getSeconds();
        this.fRotate("analogsecond", (6 * this.iCurrSecond));
    },
    fRotate:        function(sID, iDeg) {
        var sCSS = ("rotate(" + iDeg + "deg)");
        $("#" + sID).css({ '-moz-transform': sCSS, '-o-transform': sCSS, '-webkit-transform': sCSS });
    },
    fStepSize:     function(iTo, iFrom) {
        var iAnimDiff = (iFrom - iTo);
        if (iAnimDiff > 0) {
            iAnimDiff -= 360;
        }
        return iAnimDiff / this.iStepSize;
    },
    fUpdate:        function() {
        // update time
        this.dtDate = new Date();

        // hours
        var iTemp = this.fGetHour();
        if (this.iHourRotation != iTemp) {
            this.iHourRotation = iTemp;
            this.fRotate("analoghour", iTemp);
        }

        // minutes
        iTemp = this.fGetMinute();
        if (this.iMinuteRotation != iTemp) {
            this.iMinuteRotation = iTemp;
            this.fRotate("analogminute", iTemp);
        }

        // seconds
        if (this.iCurrSecond != this.dtDate.getSeconds()) {
            var iRotateFrom = (6 * this.iCurrSecond);
            this.iCurrSecond = this.dtDate.getSeconds();
            var iRotateTo = (6 * this.iCurrSecond);

            // push steps into array
            var iDiff = this.fStepSize(iRotateTo, iRotateFrom);
            for (var i = 0; i < this.iStepSize; i++) {
                iRotateFrom -= iDiff;
                this.aSecond.push(Math.round(iRotateFrom));
            }
        }
    }
};   ClockInit();
              
            
!
999px

Console