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

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="container">
    <div class="plate">
      <div class="glass">
        <div class="glass-top"></div>
        <div class="glass-right"></div>
      </div>
      <div class="pin top-left"></div>
      <div class="pin top-right"></div>
      <div class="pin bottom-left"></div>
      <div class="pin bottom-right"></div>
      <div class="clock">
        <ul>
          <li id="hours-first">
            <div class="bar">
              <div class="top"></div>
              <div class="middle"></div>
              <div class="bottom"></div>
              <div class="left-top"></div>
              <div class="left-bottom"></div>
              <div class="right-top"></div>
              <div class="right-bottom"></div>
            </div>
          </li>
          <li id="hours-second">
            <div class="bar">
              <div class="top"></div>
              <div class="middle"></div>
              <div class="bottom"></div>
              <div class="left-top"></div>
              <div class="left-bottom"></div>
              <div class="right-top"></div>
              <div class="right-bottom"></div>
            </div>
          </li>
          <li class="colon">
            <div class="colon-top"></div>
            <div class="colon-bottom"></div>
          </li>
          <li id="minutes-first">
            <div class="bar">
              <div class="top"></div>
              <div class="middle"></div>
              <div class="bottom"></div>
              <div class="left-top"></div>
              <div class="left-bottom"></div>
              <div class="right-top"></div>
              <div class="right-bottom"></div>
            </div>
          </li>
          <li id="minutes-second">
            <div class="bar">
              <div class="top"></div>
              <div class="middle"></div>
              <div class="bottom"></div>
              <div class="left-top"></div>
              <div class="left-bottom"></div>
              <div class="right-top"></div>
              <div class="right-bottom"></div>
            </div>
          </li>  
        </ul>
      </div>
    </div>
  </div>
</body>
              
            
!

CSS

              
                body {
  background-color: #eeeaec;
}

.container {
  margin: 30px auto;
  width: 300px;
  height: 200px;
}

.plate {
  position: relative;
  margin: 5% auto;
  width: 300px;
  height: 130px;
  background-image: linear-gradient(-225deg, rgba(255, 255, 255, 0.7) 0%, rgba(223, 233, 243, 0.7) 100%);
  filter: drop-shadow(3px 5px 8px rgba(0, 0, 0, 0.5));
}

.glass {
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

.glass-top,
.glass-right,
.pin {
  position: absolute;
}

.glass-top,
.glass-right {
  background-color: #007fff;
}

.glass-top {
  top: -3px;
  width: 100%;
  height: 3px;
  border-bottom: solid 0.5px #dbffff;
  border-right: solid 0.5px #dbffff;
  background: linear-gradient(135deg, #ebf1f6 0%, #f9fdff 10%, rgba(213, 235, 251, 0.99) 33%, rgba(247, 252, 255, 0.98) 60%, rgba(213, 235, 251, 0.97) 82%, rgba(213, 235, 251, 0.97) 100%);
}

.glass-right {
  right: -3px;
  width: 3px;
  height: 100%;
  border-left: solid 0.5px #dbffff;
  border-bottom: solid 0.5px #afcccc;
  background: linear-gradient(-135deg, #ebf1f6 0%, #f9fdff 10%, #89a9bf 33%, #f7fcff 60%, #89a9bf 82%, #89a9bf 100%, #d5ebfb 100%);
}

.pin {
  position: absolute;
  width: 10px;
  height: 10px;
  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), 2px 2px 4px 0px #f3f3f3 inset;
}

.top-left {
  top: 10px;
  left: 10px;
}

.top-right {
  top: 10px;
  right: 10px;
}

.bottom-left {
  bottom: 10px;
  left: 10px;
}

.bottom-right {
  bottom: 10px;
  right: 10px;
}

.clock {
  position: absolute;
  top: 20%;
  left: 10%;
  width: 80%;
  height: 60%;
}

.clock ul {
  margin: 0 auto;
  padding: 0;
  width: 224px;
  height: 77px;
  list-style: none;
  display: flex;
  justify-content: space-around;
  transform: skewX(-5deg);
}

.clock ul li {
  width: 18%;
  height: 100%;
}

.bar {
  position: relative;
  width: 100%;
  height: 100%;
}

.bar .top,
.bar .middle,
.bar .bottom,
.bar .left-top,
.bar .left-bottom,
.bar .right-top,
.bar .right-bottom {
  position: absolute;
  display: none;
  -webkit-transition: all 0.5s ease-in-out;
  transition: all 0.5s ease-in-out;
  background: linear-gradient(135deg, #f18e99 0%, #f18e99 50%, #efaeb5 57%, #f18e99 62%, #d24b5a 70%, #f18e99 100%);
}

.bar .top,
.bar .middle,
.bar .bottom {
  left: 7%;
  width: 86%;
  height: 7px;
  clip-path: polygon(12.5% 0, 87.5% 0, 100% 50%, 87.5% 100%, 12.5% 100%, 0% 50%);
}

.bar .left-top,
.bar .left-bottom,
.bar .right-top,
.bar .right-bottom {
  height: 45%;
  width: 7px;
  clip-path: polygon(50% 0, 100% 10%, 100% 90%, 50% 100%, 0 90%, 0 10%);
}

.bar .top {
  top: 0;
}

.bar .middle {
  top: calc(50% - 3.5px);
}

.bar .bottom {
  bottom: 0;
}

.bar .left-top {
  top: 5%;
  left: -2.5%;
}

.bar .left-bottom {
  bottom: 5%;
  left: -2.5%;
}

.bar .right-top {
  top: 5%;
  right: -2.5%;
}

.bar .right-bottom {
  bottom: 5%;
  right: -2.5%;
}

.zero .bar div:not(.middle) {
  display: block;
}

.one .bar .right-top,
.one .bar .right-bottom {
  display: block;
}

.two .bar .top,
.two .bar .middle,
.two .bar .bottom,
.two .bar .left-bottom,
.two .bar .right-top {
  display: block;
}

.three .bar .top,
.three .bar .middle,
.three .bar .bottom,
.three .bar .right-top,
.three .bar .right-bottom {
  display: block;
}

.four .bar .middle,
.four .bar .left-top,
.four .bar .right-top,
.four .bar .right-bottom {
  display: block;
}

.five .bar .top,
.five .bar .middle,
.five .bar .bottom,
.five .bar .left-top,
.five .bar .right-bottom {
  display: block;
}

.six .bar div:not(.right-top) {
  display: block;
}

.seven .bar .top,
.seven .bar .right-top,
.seven .bar .right-bottom {
  display: block;
}

.eight .bar div {
  display: block;
}

.nine .bar div:not(.left-bottom) {
  display: block;
}

.colon {
  width: 5%;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  z-index: 5;
}

.colon .colon-top,
.colon .colon-bottom {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(135deg, #f18e99 0%, #f18e99 50%, #efaeb5 57%, #f18e99 62%, #d24b5a 70%, #f18e99 100%);
}

              
            
!

JS

              
                const time = () => {

  const doubleNum = function (num) {
    num += "";
    if (num.length === 1) {
      num = "0" + num;
    }
    return num;
  };

  const now = new Date();
  const h = doubleNum(now.getHours());
  const m = doubleNum(now.getMinutes());

  const h1 = (h).slice(0, 1);
  const h2 = (h).slice(-1);
  const m1 = (m).slice(0, 1);
  const m2 = (m).slice(-1);

  $('.time').text(h1 + h2 + ':' + m1 + m2);

  const h1elem = $('#hours-first');
  const h2elem = $('#hours-second');
  const m1elem = $('#minutes-first');
  const m2elem = $('#minutes-second');

  const obj = [
    { time: h1, elem: h1elem },
    { time: h2, elem: h2elem },
    { time: m1, elem: m1elem },
    { time: m2, elem: m2elem },
  ];

  function add(time, elem) {
    elem.removeClass();
    if (time == 1) {
      elem.addClass('one');
    } else if (time == 2) {
      elem.addClass('two');
    } else if (time == 3) {
      elem.addClass('three');
    } else if (time == 4) {
      elem.addClass('four');
    } else if (time == 5) {
      elem.addClass('five');
    } else if (time == 6) {
      elem.addClass('six');
    } else if (time == 7) {
      elem.addClass('seven');
    } else if (time == 8) {
      elem.addClass('eight');
    } else if (time == 9) {
      elem.addClass('nine');
    } else {
      elem.addClass('zero');
    }
  }

  $.each(obj, function (index, val) {
    add(val.time, val.elem);
  });

};
time();

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

timeUpdate();
              
            
!
999px

Console