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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <body>
  <div class="circle">
    <div class="inner">
      <div class="time one">&#8544;</div>
      <div class="time two">&#8545;</div>
      <div class="time three">&#8546;</div>
      <div class="time four">&#8547;</div>
      <div class="time five">&#8548;</div>
      <div class="time six">&#8549;</div>
      <div class="time seven">&#8550;</div>
      <div class="time eight">&#8551;</div>
      <div class="time nine">&#8552;</div>
      <div class="time ten">&#8553;</div>
      <div class="time eleven">&#8554;</div>
      <div class="time twelve">&#8555;</div>
      <div class="short"></div>
      <div class="long"></div>
    </div>
  </div>
</body>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  color: #222;
  font-size: 20px;
}

.circle {
  position: relative;
  margin: 20px auto;
  width: 255px;
  height: 255px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  border: 9px solid #192f60;
  background: #f3f3f3;
  box-shadow: 4px 4px 0px #bfbfbf, 
              inset 3px 3px 0px #e6e6e6, 
              inset 2px 4px 8px #555;
  filter: drop-shadow(2px 3px 6px #777);
}

.circle::before{
  position: absolute;
  inset:0;
  content: "";
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(247,247,247,0.5) 0%,rgba(209,232,255,0.1) 20%,rgba(255,255,255,0.7) 30%,rgba(224,239,255,0.1) 50%,rgba(255,255,255,0.7) 70%,rgba(209,232,255,0.2) 80%,rgba(247,247,247,0.3) 100%);  
  z-index: 10;
}

.inner {
  position: relative;
  transform: translate(2px, 2px);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-image: linear-gradient(135deg, #b0b0b0 0%, #b5b5b5 1%, #d9d9d9 20%, #efefef 48%, #d9d9d9 75%, #bcbcbc 100%);
  box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.65), inset 2px 2px 4px 0px #f3f3f3;
  transform-style: preserve-3d;
}

.time,
.long,
.short {
  position: absolute;
  inset: 0;
  line-height: 1.1;
  font-weight: 700;
}

.short,
.long {
  background: #808080;
  transform-origin: bottom center;
}

.short {
  top: calc(10px - 55px);
  left: calc(50% - 2px);
  width: 6px;
  height: 55px;
}

.long {
  top: calc(10px - 80px);
  left: calc(50% - 1px);
  width: 3px;
  height: 80px;
}

.one {
  transform: translate(50px, -86.6px) rotate(-150deg);
}

.two {
  transform: translate(86.6px, -50px) rotate(-120deg);
}

.three {
  transform: translate(100px, 0) rotate(-90deg);
}

.four {
  transform: translate(86.6px, 50px) rotate(-60deg);
}

.five {
  transform: translate(50px, 86.6px) rotate(-30deg);
}

.six {
  transform: translate(0px, 100px);
}

.seven {
  transform: translate(-50px, 80px) rotate(30deg);
}

.eight {
  transform: translate(-86.6px, 50px) rotate(60deg);
}

.nine {
  transform: translate(-100px, 0px) rotate(90deg);
}

.ten {
  transform: translate(-86.6px, -50px) rotate(120deg);
}

.eleven {
  transform: translate(-50px, -86.6px) rotate(150deg);
}

.twelve {
  transform: translate(0px, -100px) rotate(180deg);
}
              
            
!

JS

              
                const time = () => {

  const now = new Date();
  const h = now.getHours();
  const m = now.getMinutes();
  const short = $('.short');
  const long = $('.long');
  
  const shortDeg = h < 13 ? h * 30 + m / 60 * 30 : (h - 12) * 30 + m / 60 * 30;
  short.css('transform', 'rotate(' + shortDeg + 'deg) translateZ(-1px)');
  
  const longDeg = m * 6;
  long.css('transform', 'rotate(' + longDeg + 'deg) translateZ(-2px)');
  
  if (shortDeg < 90) {
    short.css('box-shadow', '0.7px 0px 1.5px #000');
  } else if (shortDeg < 180){
    short.css('box-shadow', '0.7px -0.7px 1.5px #000');
  } else if (shortDeg < 270){
    short.css('box-shadow', '-0.7px -0.7px 1.5px #000');
  } else {
    short.css('box-shadow', '-0.7px 0px 1.5px #000');
  }    

  if (longDeg < 90) {
    long.css('box-shadow', '0.7px 0px 1.5px #000');
  } else if (longDeg < 180){
    long.css('box-shadow', '0.7px -0.7px 1.5px #000');
  } else if (longDeg < 270){
    long.css('box-shadow', '-0.7px -0.7px 1.5px #000');
  } else {
    long.css('box-shadow', '-0.7px 0px 1.5px #000');
  }    

};

time();

const timeUpdate = () => {
  time();
  setTimeout(timeUpdate, 60000);
};

timeUpdate();
              
            
!
999px

Console