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

              
                .container
  .progressContainer
    .progress
  button(onclick="progress()")="Click"

.result.hide
  | Finish!

              
            
!

CSS

              
                html,body
  margin: 0
  padding: 0
  text-align: center

.container
  width: auto
  padding: 15px
  
  .progressContainer
    width: 100%
    height: 30px    
    background: linear-gradient(-45deg, rgba(195,195,228,.7), rgba(229,193,135,.7), )
    padding: 1px
    overflow: hidden
    .progress
      width: 1%
      height: 30px
      background-color: lightblue
      background: linear-gradient(-45deg, rgba(229,93,135,.7), rgba(95,195,228,.7))
      overflow: hidden

  button
    margin-top: 20px
    padding: 10px 20px
    background: #fff

.result
  font-size: 48px
  color: orange
  opacity: 1
  transition: 1s

.hide
  font-size: 0
  opacity: 0
              
            
!

JS

              
                function progress() {
  const result = document.querySelector(".result");
  const el = document.querySelector(".progress");

  let width = 1;
  const id = setInterval(frame, 1000);
  let secVal = 5; // set second
  const sec = width / secVal * 100;
  /* 1000 = 1sec = 1%
     Default = 100秒 > 100でかける
  */
  function frame() {
    if (width >= 100) {
      sec == 100;
      console.log("finish");
      clearInterval(id);
      result.classList.remove("hide");
      result.innerHTML = "Finish!";
    } else {
      width = width + sec;
      el.style.width = width - 1 + "%";
      console.log("width" + (width - 1));
    }
  }
}
              
            
!
999px

Console