Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                <h1>
  <pre>&lt;progress&gt;</pre>
</h1>

<div class="progress">
  <progress id="js-progressbar" value="" max="100"></progress>
  <span id="js-animal" class="animal">🦔</span>
</div>

<main id="js-main">
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Amet cursus sit amet dictum sit amet. Eget est lorem ipsum dolor. Viverra ipsum nunc aliquet bibendum enim. Ullamcorper malesuada proin libero nunc consequat interdum varius sit amet. Diam donec adipiscing tristique risus nec feugiat in. Et netus et malesuada fames. Quisque id diam vel quam elementum pulvinar etiam. Cursus turpis massa tincidunt dui ut ornare lectus. Quam elementum pulvinar etiam non quam lacus suspendisse faucibus interdum. Sed cras ornare arcu dui vivamus arcu.</p>
  
  <p>Sagittis purus sit amet volutpat. Senectus et netus et malesuada fames. Commodo elit at imperdiet dui accumsan sit amet nulla. Morbi tristique senectus et netus et. Posuere ac ut consequat semper viverra nam libero justo. Lectus proin nibh nisl condimentum id. Sed vulputate mi sit amet mauris commodo quis. Turpis in eu mi bibendum neque. Eget dolor morbi non arcu risus quis varius quam quisque. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Ultricies mi quis hendrerit dolor. Nunc sed id semper risus in hendrerit gravida rutrum quisque. Turpis egestas sed tempus urna et pharetra pharetra massa.</p>

  <p>Tortor pretium viverra suspendisse potenti nullam ac tortor. Curabitur vitae nunc sed velit dignissim. Scelerisque eleifend donec pretium vulputate sapien nec sagittis aliquam. Condimentum lacinia quis vel eros donec ac odio tempor. Auctor augue mauris augue neque gravida in fermentum. Nec feugiat in fermentum posuere urna. Malesuada fames ac turpis egestas maecenas. Vestibulum lectus mauris ultrices eros in cursus. In hendrerit gravida rutrum quisque non tellus orci ac auctor. Id aliquet risus feugiat in ante metus. Dolor magna eget est lorem ipsum dolor sit amet. Lacus luctus accumsan tortor posuere ac ut consequat semper.</p>
  
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Amet cursus sit amet dictum sit amet. Eget est lorem ipsum dolor. Viverra ipsum nunc aliquet bibendum enim. Ullamcorper malesuada proin libero nunc consequat interdum varius sit amet. Diam donec adipiscing tristique risus nec feugiat in. Et netus et malesuada fames. Quisque id diam vel quam elementum pulvinar etiam. Cursus turpis massa tincidunt dui ut ornare lectus. Quam elementum pulvinar etiam non quam lacus suspendisse faucibus interdum. Sed cras ornare arcu dui vivamus arcu.</p>
  
  <p>Sagittis purus sit amet volutpat. Senectus et netus et malesuada fames. Commodo elit at imperdiet dui accumsan sit amet nulla. Morbi tristique senectus et netus et. Posuere ac ut consequat semper viverra nam libero justo. Lectus proin nibh nisl condimentum id. Sed vulputate mi sit amet mauris commodo quis. Turpis in eu mi bibendum neque. Eget dolor morbi non arcu risus quis varius quam quisque. Id venenatis a condimentum vitae sapien pellentesque habitant morbi tristique. Ultricies mi quis hendrerit dolor. Nunc sed id semper risus in hendrerit gravida rutrum quisque. Turpis egestas sed tempus urna et pharetra pharetra massa.</p>

  <p>Non diam phasellus vestibulum lorem sed risus ultricies tristique nulla. Ullamcorper velit sed ullamcorper morbi tincidunt. Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Justo eget magna fermentum iaculis eu non diam. In fermentum et sollicitudin ac orci phasellus egestas tellus rutrum. Nunc non blandit massa enim nec. Diam maecenas ultricies mi eget mauris pharetra. Proin nibh nisl condimentum id venenatis a. Dui faucibus in ornare quam viverra orci sagittis. Eu mi bibendum neque egestas congue quisque egestas diam in. Elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique. Nunc consequat interdum varius sit amet. Placerat duis ultricies lacus sed turpis tincidunt id aliquet. Mattis nunc sed blandit libero.</p>

  <p>Aliquam ut porttitor leo a diam sollicitudin tempor id eu. Id interdum velit laoreet id donec. Et malesuada fames ac turpis egestas sed tempus. In mollis nunc sed id. Mauris vitae ultricies leo integer malesuada nunc vel. Egestas fringilla phasellus faucibus scelerisque eleifend. Suspendisse potenti nullam ac tortor vitae purus faucibus. Fermentum odio eu feugiat pretium nibh ipsum consequat. Ipsum dolor sit amet consectetur adipiscing. Pretium vulputate sapien nec sagittis. Tortor vitae purus faucibus ornare suspendisse.</p>
</main>
<div class="links">
  <a class="link-ciu" target="_blank" href="https://caniuse.com/#feat=progress">Can i use</a>
  -
  <a target="_blank" href="https://developer.mozilla.org/fr/docs/Web/HTML/Element/Progress">MDN</a>
</div>
              
            
!

CSS

              
                :root {
  --move: 0;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: linear-gradient(-225deg, #ad597b 0%, #d8707f 48%, #f7bd96 100%);
}

.progress {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: none;
  border: 0;
  height: auto;
  margin: 0;
  padding: 0;
  pointer-events: none;

  progress {
    position: relative;
    display: block;
    height: 20px;
    width: 100%;
    border: 0;
    background-color: transparent;
    -webkit-appearance: none;
  }

  ::-moz-progress-bar {
    background-image: linear-gradient(132deg, #F4D03F 0%, #16A085 100%);
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
  }

  ::-webkit-progress-bar {
    background-color: transparent;
  }

  ::-webkit-progress-value {
    background-image: linear-gradient(132deg, #F4D03F 0%, #16A085 100%);
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
  }
  
  .animal {
    position: absolute;
    display: block;
    top: -1.8rem;
    left: calc(var(--move) - 2.3rem);
    transform: scaleX(-1);
    font-size: 4rem;
    z-index: 1;
  }

}

main {
  position: relative;
  max-width: 480px;
  max-height: 480px;
  padding: 20px 10px 20px 20px;
  overflow-y: scroll;
  background: #fff;
  
  p {
    margin: 0 0 1rem;
  }
  
}

h1 {
  color: #fff;
  margin: 0;
  
  pre {
    
    span {
      background-color: rgba(#000,.15);
      padding: 0.3rem;
      border-radius: 6px;
    }
  }
}

.links {
  color: #fff;
  margin: 1rem auto;
  
  a {
    display: inline-block;
    color: #fff;
    font-size: 0.8rem;
  }
}

              
            
!

JS

              
                /* Progress bar */
const main = document.querySelector('#js-main');
const animal = document.querySelector('#js-animal');
const progressBar = document.querySelector('#js-progressbar');
let mainScroll = main.scrollTop;
let mainHeight = main.scrollHeight - main.clientHeight;
let scrollPercent = (mainScroll / mainHeight) * 100;

progressBar.setAttribute('value', scrollPercent);
animal.style.setProperty('--move', scrollPercent + '%');

main.addEventListener('scroll', function() {
  mainScroll = main.scrollTop;
  mainHeight = main.scrollHeight - main.clientHeight;
  scrollPercent = (mainScroll / mainHeight) * 100;
  progressBar.setAttribute('value', scrollPercent);
  animal.style.setProperty('--move', scrollPercent + '%');
});

              
            
!
999px

Console