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

              
                <div class="countdown">
  <h1 id="title">Christmas Is In</h1>
  <p id="countdown">Calculating Time</p>
</div>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
}
body {
  background-color: white;
  font-family: sans-serif;
  text-align: center;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}
.countdown {
  background-color: white;
  align-self: center;
  margin: 0 auto;
  border-radius: 100vh;
  padding: 1em 3em;
  box-shadow: 0 0 2rem rgba(0, 0, 0, 0.1);
}
.countdown h1 {
  color: red;
  font-size: 1.5rem;
  font-weight: 600;
}
.countdown p {
  color: green;
  font-size: 1.5rem;
  font-weight: 400;
}
              
            
!

JS

              
                // Set the date we're counting down to
var countDownDate = new Date("Dec 25, 2023").getTime();
// Update the count down every 1 second
var x = setInterval(function () {
  // Get today's date and time
  var now = new Date().getTime();
  // Find the distance between now and the count down date
  var distance = countDownDate - now;
  // Time calculations for days, hours, minutes and seconds
  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  // Display the result in the title
  document.title = `Christmas Is In ${days} Days ${hours} Hours ${minutes} Minutes ${seconds} Seconds`;
  // Display the result in the element with id="countdown"
  document.getElementById("countdown").innerText = `${days} Days ${hours} Hours ${minutes} Minutes ${seconds} Seconds`;
  // If the count down is finished, write "Merry Christmas!"
  if (distance < 0) {
    clearInterval(x);
    document.getElementById("countdown").remove();
    document.title = "Merry Christmas!";
    document.getElementById("title").innerText = "Merry Christmas!";
  }
}, 1000);
              
            
!
999px

Console