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.


                <!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
<a href="//" target="_blank">
  <h2> TechieBundle: Get More Template Click Here...</h2>
  <h1> Analog Clock</h1>
  <div class="clock-box">
   <div id="clock">
    <div id="hour" class="hand"></div>
    <div id="minute" class="hand"></div>
    <div id="second" class="hand"></div>
    <div id="center-dot"></div>
    <div class="hour-indicator hour-12">12</div>
    <div class="hour-indicator hour-3">3</div>
    <div class="hour-indicator hour-6">6</div>
    <div class="hour-indicator hour-9">9</div>


                body {
      height: 100vh;
      margin: 0 auto;
      background: linear-gradient(to bottom right, #3494e6, #ec6ead);
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

a {
  text-align: center;
  color: #ececec;
  text-align: center;
    #clock {
      width: 200px;
      height: 200px;
      border: 6px solid #fff;
      border-radius: 50%;
      position: relative;
      background: linear-gradient(to bottom, #a18cd1, #fbc2eb);
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);

    .hand {
      position: absolute;
      transform-origin: 50% 100%;
      transition: transform 0.5s cubic-bezier(0.4, 2.5, 0.36, 0.84);

    #hour {
      height: 50px;
      width: 6px;
      top: 50px;
      left: 97px;
      background: #fff;
      border-radius: 4px;
      box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);

    #minute {
      height: 80px;
      width: 4px;
      top: 20px;
      left: 98px;
      background: #fff;
      border-radius: 4px;
      box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);

    #second {
      height: 90px;
      width: 2px;
      top: 10px;
      left: 99px;
      background: #ff3d67;
      border-radius: 2px;
      box-shadow: 0 0 6px rgba(255, 61, 103, 0.8);

    #center-dot {
      position: absolute;
      width: 12px;
      height: 12px;
      background: #fff;
      border-radius: 50%;
      top: 94px;
      left: 94px;
      box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);

    .hour-indicator {
      position: absolute;
      font-size: 14px;
      font-weight: bold;
      color: #333;

    .hour-12 { top: 5px; left: 86px; }
    .hour-3 { top: 92px; left: 184px; }
    .hour-6 { bottom: 5px; left: 86px; }
    .hour-9 { top: 90px; left: 8px; }

    #digital-time {
      font-size: 24px;
      font-weight: bold;
      color: #fff;
      margin-top: 20px;


                function updateClock() {
    const now = new Date();
    const hours = now.getHours() % 12;
    const minutes = now.getMinutes();
    const seconds = now.getSeconds();

    const hourDegree = (hours + minutes / 60) * 30;
    const minuteDegree = (minutes + seconds / 60) * 6;
    const secondDegree = seconds * 6;

    document.getElementById('hour').style.transform = `rotate(${hourDegree}deg)`;
    document.getElementById('minute').style.transform = `rotate(${minuteDegree}deg)`;

    if (seconds === 0) {
      // If seconds is zero, set the rotation directly to zero
      document.getElementById('second').style.transition = 'none';
      document.getElementById('second').style.transform = 'rotate(0deg)';
      setTimeout(() => {
        document.getElementById('second').style.transition = 'transform 0.5s cubic-bezier(0.4, 2.5, 0.36, 0.84)';
      }, 50);
    } else {
      document.getElementById('second').style.transform = `rotate(${secondDegree}deg)`;

  setInterval(updateClock, 1000);
  updateClock(); // Initial call to set the initial clock state