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

              
                <!-- let's creat a timer with js -->

    <div class="container">

      <div class="groub">

        <button disabled="disabled" class="reset">reset timer</button>
        <button class="start">Start timer</button>
        <button disabled="disabled" class="pause">pause timer</button>
      </div>


      <div id="hours"> 0 </div>
      :
      <div id="minutes"> 0 </div>
      :
      <div id="seconds"> 0 </div>
    </div>
              
            
!

CSS

              
                *
  padding: 0
  margin: 0
  box-sizing: border-box
  font-family: sans-serif
  text-transform: uppercase

.container
  position: absolute
  height: 100%
  width: 100%
  top: 0
  left: 0
  background: black
  display: flex
  align-items: center
  justify-content: center
  font-family: sans-serif
  font-size: 80px
  color: white
  letter-spacing: 10px

.groub
  position: absolute
  top: 0
  left: 0
  width: 100%
  padding: 30px 30px
  display: flex
  align-items: center
  justify-content: center

button
  position: relative
  width: 200px
  height: 60px
  background: transparent
  font-size: 18px
  letter-spacing: 3px
  color: white
  border: 2px solid white
  cursor: pointer
  transition: 0.4s ease-in-out all
  &:hover
    background: white
    color: black

button[disabled="disabled"]
  color: gray
  border-color: gray
  &:hover
    background: transparent
    cursor: default

              
            
!

JS

              
                var hours = document.getElementById('hours'),
    minutes = document.getElementById('minutes'),
    seconds = document.getElementById('seconds'),
    container = document.querySelector('.container'),
    start = document.querySelector('.start'),
    pause = document.querySelector('.pause'),
    reset = document.querySelector('.reset'),
    count_time = 0;


start.onclick = function(){
  var counter = setInterval(function(){
    count_time++;
    if (count_time > 0) {
      seconds.textContent = count_time;
    }
    if (count_time === 60) {
      count_time = 0;
      minutes.textContent++;
    }
    if (minutes.textContent == 60) {
      minutes.textContent = 0;
      hours.textContent++;
    }
  }, 1000);

  pause.removeAttribute('disabled');
  reset.removeAttribute('disabled');
  start.setAttribute('disabled', 'disabled');

  pause.onclick = function(){
    clearInterval(counter);
    start.removeAttribute('disabled');
    pause.setAttribute('disabled', 'disabled');
  }
  reset.onclick = function(){
    clearInterval(counter);
    count_time = 0;
    seconds.textContent = 0;
    minutes.textContent = 0;
    hours.textContent = 0;
    start.removeAttribute('disabled');
    reset.setAttribute('disabled', 'disabled');
    pause.setAttribute('disabled', 'disabled');
  }
}

              
            
!
999px

Console