Pen Settings



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


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


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.


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.


%h1 This is what you are looking for.
%h1 Pure Vanilla JS


                body {
  background: black;
.time, h1 {
  font-family: Helvetica;
  font-size: 6em;
  color: white;


                // A simple vanilla JS clock

// Initilize variables for date, hour, minute, second, am or pm, and the final displayed time
var d, h, m, s, ampm, time;

// Your clock!
function displayTime() {
  d = new Date();
  h = d.getHours();
  m = d.getMinutes();
  s = d.getSeconds();
  ampm = h >= 12 ? 'pm' : 'am';
  h = h % 12;

  // Adds zeros to single digit times
  if (h <= 9) {
    h = '0' + h;
  if (m <= 9) {
    m = '0' + m;
  if (s <= 9) {
    s = '0' + s;

  // Assign time format to variable. If you want to change how time is displayed do it here
  // Example time = h + ":" + m;
  time = h + ":" + m + ":" + s + " " + ampm;

  // Print your clock to an element.
  document.getElementsByClassName("time")[0].innerHTML = time;

  // Refreshes clock every second. If you're just using minutes change to 60000
  setTimeout(displayTime, 1000);

// Run your baller clock!