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

              
                <div id="clock" class="center">
  H J L L Y A V R O K M S<br/>
  <span class="active">I T</span> E <span class="active">I S</span> B P W C V A Q<br/> X <span class="min m15">A</span> M <span class="min m15">Q U A R T E R</span> S T<br/>
  <span class="min m20 m25 m35 m40">T W E N T Y</span> V <span class="min m5">F I V E</span> P<br/>
  <span class="min m30">H A L F</span> Y <span class="min m10 m50">T E N</span> Z S <span class="before">T O</span><br/> P <span class="after">P A S T</span> I X <span class="hour h9">N I N E</span> S<br/>
  <span class="hour h1">O N E</span> <span class="hour h6">S I X</span> M <span class="hour h3">T H R E E</span><br/>
  <span class="hour h4">F O U R</span> Y <span class="hour h5">F I V E</span> <span class="hour h2">T W O</span><br/>
  <span class="hour h8">E I G H T</span> C <span class="hour h11">E L E V E N</span><br/>
  <span class="hour h7">S E V E N</span> D <span class="hour h0">T W E L V E</span><br/> H <span class="hour h10">T E N</span> Q O <span class="min m0">O C L O C K</span><br/> A M D N J L W F H L A T
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=PT+Mono");

$current: #dddd55;
$disable: rgba(0,0,0,0.5);
$time: 3600s;

html,
body {
  background: #106020;
  font-family: "PT Mono", courier, "courier new", sans-serif;
  font-size: 4vmin;
  font-weight: bold;
  color: $disable;
}

#clock {
  white-space: nowrap;
}

.center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
}

.active {
  color: $current;
}

@keyframes m0m30 {
  0% { color: $current; }
  8.33333% { color: $disable; }
}

@keyframes m5m25m35m55 {
  0% { color: $disable; }
  8.33333% { color: $current; }
  16.66666% { color: $disable; }
  41.66666% { color: $current; }
  50% { color: $disable; }
  58.33333% { color: $current; }
  66.66666% { color: $disable; }
  91.66666% { color: $current; }
}

@keyframes m10m50 {
  0% { color: $disable; }
  16.66666% { color: $current; }
  25% { color: $disable }
  83.33333% { color: $current; }
  91.66666% { color: $disable; }
}

@keyframes m20m25m35m40 {
  0% { color: $disable; }
  33.33333% { color: $current; }
  50% { color: $disable; }
  58.33333% { color: $current; }
  75% { color: $disable; }
}

@keyframes m15m45 {
  0% { color: $disable; }
  25% { color: $current; }
  33.33333% { color: $disable; }
  75% { color: $current; }
  83.33333% { color: $disable; }
}

@keyframes past {
  0% { color: $disable; }
  8.33333% { color: $current; }
  58.33333% { color: $disable; }
  100% { color: $disable; }
}

@keyframes to {
  0% { color: $disable; }
  58.33333% { color: $current; }
  100% { color: $current; }
}

.m0, .m30 {
  animation: infinite m0m30 step-end $time;
}

.m30 {
  animation-delay: $time/2;
}

.h0, .h1, .h2, .h3, .h4, .h5, .h6, 
.h7, .h8, .h9, .h10, .h11, .h12 {
  animation: infinite m0m30 step-end ($time * 12);
  animation-delay: -$time/2;
}

.m5 {
  animation: infinite m5m25m35m55 step-end $time;
}

.m10, .m50 {
  animation: infinite m10m50 step-end $time;
}

.m20, .m25, .m35, .m40 {
  animation: infinite m20m25m35m40 step-end $time;
}

.m15, .m45 {
  animation: infinite m15m45 step-end $time;
}

.after {
  animation: infinite past step-end $time;
}

.before {
  animation: infinite to step-end $time;
}

$k: 0;
@while $k < 60 {
  .minute#{$k} {
    $l: 0;
    @while $l < 60 {
      .m#{$l} {
        animation-delay: - $time * $k / 60;
      }
      $l: $l + 5;
    }
    
    .before,
    .after { animation-delay: -$time * $k / 60; }
    .m30 { animation-delay: $time/2 - $time * $k / 60; }
    
    @for $i from 0 through 11 {
      &.hour#{$i} {
        @for $j from 0 through 11 {
          .h#{$j} { animation-delay: (-$time*5/12 + $time*($j - $i)) -  ($time * $k / 60); }
        }
      }
    }
  }
  $k: $k + 5;
}


              
            
!

JS

              
                /**
 * This code is just to set the initial timing, it could be done on the server side without needing any JS
 */
var date = new Date();
var minutes = 5 * Math.round(date.getMinutes() / 5);
var hours = date.getHours() % 12;

document.getElementById("clock").classList.add("minute" + minutes);
document.getElementById("clock").classList.add("hour" + hours);
              
            
!
999px

Console