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

              
                <ul>
  <li class="btn-square">Watch1</li>
  <li class="btn">Watch2</li>
  <li class="btn-white">Watch3</li>
</ul>


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

  <div class="face">
    <ul>
      <li></li>
      <li></li>
      <li></li> 
      <li></li>
    </ul>
  </div>
</div>
  
  <div class="strap"></div>
</article>
              
            
!

CSS

              
                @import "compass/css3";

*, *:before, *:after {
  box-sizing: border-box;
  transition: 1s;
}

html {
  background: #27ae60; 
}


ul {
 list-style: none;
  
  li {
    color: #fff;
    cursor: pointer;
   font-size: 2em;
    
  }
}


$watch-color: #34495e;
$watch_black-color: #282828;
$watch_white-color: #ecf0f1;

.watch {

.base {
  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; 
  }
}

.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;
        &:after {
          content: '12'; 
        }
      }
      
      &:nth-child(2) {
        margin-top: -0.75em;
        right: 0; 
        top: 50%;
        &:after {
          content: '3'; 
        }
      }
      
      &:nth-child(3) {
        bottom: 0;
        left: 50%;
        margin-left: -0.75em;
        &:after {
          content: '6'; 
        }
      }
      &:nth-child(4) {
        margin-top: -0.75em;
        left: 0; 
        top: 50%;
        &:after {
          content: '9'; 
        }     
      }
    }
  }
  
  &: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%;
  }
  
}
.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; 
}


.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*="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%  ; 
}

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

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

.hand-hour {
  width: 0.6em;
  top: 4em;
  height: 6em; 
}
.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;
  }
}

}


// watch_square 
.watch_square {

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


.crown {
  background-color: black;
  background-image: linear-gradient(transparent 50%, rgba(255,255,255,.2) 50%);
  background-size: 6px 6px; 
  border-radius: 0.2em;
  height: 2em;
  left: 50%;
  margin-left: 10.9em;
  margin-top: -1em;
  position: absolute;
  top: 50%;
  width: 1em; 
}




.face {
  border-radius: 50%;
  height: 100%;
  width: 100%;
  
  ul {
    list-style: none;
    
    li {
      background: $watch_black-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;
        &:after {
          content: '|'; 
        }
      }
      
      &:nth-child(2) {
        margin-top: -0.75em;
        right: 0; 
        top: 50%;
        transform: rotate(90deg);
        &:after {
          content: '|';
        }
      }
      
      &:nth-child(3) {
        bottom: 0;
        left: 50%;
        margin-left: -0.75em;
        &:after {
          content: '|'; 
        }
      }
      &:nth-child(4) {
        margin-top: -0.75em;
        left: 0; 
        top: 50%;
        transform: rotate(90deg);
        &:after {
          content: '|'; 
        }
      }      
      
    }
  }
  
  &: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: 2em solid #202020;
    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: 50%;
    left: 25%; 
    position: absolute;
    top: 25%;
    width: 50%; 
  } 
  
}

.strap {
  background-color: #282828;
  border-left: none;
  border-right: none;
  box-shadow: 
    inset  -0.4em 0 0.3em rgba(white,0.05),
    inset 0.4em 0 0.3em rgba(white,0.05), 
    -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*="hand-"] {
  background-color: #bfbfbf;
  border-radius: 0; 
  
  left: 9.8em;
  position: absolute;
  top: 2em;
  z-index: 4;
  transform-origin: 50% 100%  ; 
}

.hand-second {
  background: #a90000;
  width: 0.2em;
  top: 0.1em;
  height: 10em; 
}

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

.hand-hour {
  width: 0.6em;
  top: 4em;
  height: 6em; 
}
.center-circle {
  background: #ecf0f1;
  box-shadow: 0 0 0.1em rgba(black,0.4);
  border-radius: 0.5em;
  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;
  }
}

}


// Watch_white 
.watch_white {

 
.base {
  background: $watch_white-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: rgb(255,255,255);
@include filter-gradient(#ffffff, #ffffff, vertical);
@include background-image(linear-gradient(top,  rgba(255,255,255,1) 0%,rgba(243,243,243,1) 50%,rgba(237,237,237,1) 51%,rgba(255,255,255,1) 100%));
    border-radius: 50%;
    position: absolute;
    height: 20.5em;
    left: -0.25em;
    top: -0.25em;
    width: 20.5em;
    z-index: -1; 
  }
  
  &:before {
    box-shadow: -0.2em -0.4em 0.5em rgba(black,0.2);
    height: 22em;
    left: -1em;
    transform: rotate(180deg);
    top: -1em;
    width: 22em; 
  }
}


.crown {
  background-color: black;
  background-image: linear-gradient(transparent 50%, rgba(255,255,255,.2) 50%);
  background-size: 6px 6px; 
  border-radius: 0.2em;
  height: 2em;
  left: 50%;
  margin-left: 10.9em;
  margin-top: -1em;
  position: absolute;
  top: 50%;
  width: 1em; 
}




.face {
  border-radius: 50%;
  height: 100%;
  width: 100%;
  
  ul {
    list-style: none;
    
    li {
      background: $watch_white-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;
        &:after {
          content: 'XII'; 
        }
      }
      
      &:nth-child(2) {
        margin-top: -0.75em;
        right: 0; 
        top: 50%;
        &:after {
          content: 'III';
        }
      }
      
      &:nth-child(3) {
        bottom: 0;
        left: 50%;
        margin-left: -0.75em;
        &:after {
          content: 'V|'; 
        }
      }
      &:nth-child(4) {
        margin-top: -0.75em;
        left: 0; 
        top: 50%;
        &:after {
          content: '|X'; 
        }
      }      
      
    }
  }
  
  &: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: 2em solid #ccc;
    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: 50%;
    left: 25%; 
    position: absolute;
    top: 25%;
    width: 50%; 
  } 
  
}

.strap {
  background-color: #282828;
  border-left: none;
  border-right: none;
  box-shadow: 
    inset  -0.4em 0 0.3em rgba(white,0.05),
    inset 0.4em 0 0.3em rgba(white,0.05), 
    -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*="hand-"] {
  background-color: #444;
  border-radius: 0; 
  
  left: 9.8em;
  position: absolute;
  top: 2em;
  z-index: 4;
  transform-origin: 50% 100%  ; 
}

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

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

.hand-hour {
  width: 0.6em;
  top: 4em;
  height: 6em; 
}
.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

              
                $('.btn-square').click(function() {
   $('article').removeAttr('class');
  $('html').css("background","#27ae60");
  $('article').addClass('watch_square');
});

$('.btn').click(function() {
   $('article').removeAttr('class');
  $('html').css("background","#2980b9");
  $('article').addClass('watch');
});


$('.btn-white').click(function() {
   $('article').removeAttr('class');
  $('article').addClass('watch_white');
  $('html').css("background","#8e44ad");
});
/* I didn't write the JS for the clock workings, 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