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="progress-bar"></div>
<header>
  <span class="hamburger">🍔</span>
  <div class="logo"></div>
</header>
<main id="main" class="container">
  <h1 id="main-title">Lorem ipsum dolor sit amet</h1>
  <a href="https://unsplash.com/photos/ljb3u4eC3bM"><img id="featured-image" src="https://images.unsplash.com/photo-1594405739404-bc878da14da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2371&q=80" width="1245" height="830"></a>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque accumsan euismod mauris, eget ornare erat luctus at. Etiam quis enim sed orci eleifend condimentum. Quisque pulvinar libero ante, non faucibus neque suscipit non. Duis sodales nisi a lacus sagittis tincidunt. Praesent a risus malesuada ligula condimentum dictum vel sit amet leo. Vestibulum maximus nibh nec cursus iaculis. Fusce vulputate magna vitae nisi ornare blandit. Sed sagittis sagittis fringilla. Suspendisse cursus lorem metus, eget venenatis felis porttitor a. Praesent ultricies lectus a odio rutrum, ut convallis velit porta.</p>
  <p>Sed euismod lectus at dolor auctor efficitur. Aenean dignissim, elit sed facilisis lacinia, velit sem tincidunt mi, ultricies mattis nibh sapien sit amet arcu. <a href="http://store.daniellemlbastien.com">Maecenas a dui ex.</a> Proin at neque accumsan, convallis felis sit amet, elementum leo. Sed nisi tellus, blandit in hendrerit eu, rhoncus vitae nunc. Proin viverra egestas quam sed interdum.</p>

  <a href="https://unsplash.com/photos/n_uraBThPlM"><img id="img1" loading="lazy" src="https://images.unsplash.com/photo-1652184887839-7498099d5bad?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=987&q=80" alt="" width="651" height="976" /></a>

  <p>Morbi blandit, <a href="#">magna</a> non fermentum congue, arcu nibh egestas velit, tempor elementum justo odio a ipsum. Integer dictum odio eu dapibus condimentum. Proin pharetra lectus a purus sollicitudin hendrerit. Aliquam erat volutpat. Morbi cursus euismod posuere. Phasellus non porta velit. Donec imperdiet malesuada malesuada.</p>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque accumsan euismod mauris, eget ornare erat luctus at. Etiam quis enim sed orci eleifend condimentum. Quisque pulvinar libero ante, non faucibus neque suscipit non. Duis sodales nisi a lacus sagittis tincidunt.</p>
  <p> Praesent a risus malesuada ligula condimentum dictum vel sit amet leo. Vestibulum maximus nibh nec cursus iaculis. Fusce vulputate magna vitae nisi ornare blandit. Sed sagittis sagittis fringilla. Suspendisse cursus lorem metus, eget venenatis felis porttitor a. Praesent ultricies lectus a odio rutrum, ut convallis velit porta.</p>
  <a href="https://unsplash.com/photos/ArOQBbxztv8"><img id="img2" loading="lazy" src="https://images.unsplash.com/photo-1645905306015-422c0ec6af26?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=987&q=80" alt="" width="651" height="976" /></a>

  <p>Quisque accumsan euismod mauris, eget ornare erat luctus at. Etiam quis enim sed orci eleifend condimentum. Fusce vulputate magna vitae nisi ornare blandit. Sed sagittis sagittis fringilla.</p>
</main>
              
            
!

CSS

              
                $white: rgb(247, 247, 247);
$blue: rgb(0, 129, 157);
$purple: rgb(157, 81, 220);
$green: rgb(91, 130, 0);

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16pt;
}

body {
  overflow-x: hidden;
  font-size: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  line-height: 1.5;
}

.container {
  max-width: min(75ch, 50vw);
  margin: 1rem auto;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}
h1 {
  margin-bottom: 0.75rem;
}
p,
img {
  margin-bottom: 1.5rem;
}

a {
  color: $blue;
  &:visited {
    color: $purple;
  }
  &:hover,
  &:active {
    color: $green;
  }
}
header {
  background-color: white;
  border-bottom: 2px solid black;
  padding: .5rem;
  position: sticky;
  top: .5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .logo {
    justify-self: center;
    border-radius: 100%;
    background-color: green;
    height: 48px;
    width: 48px;
  }
}

/// ----------------------

@scroll-timeline bodyProgress {
  time-range: 1s;
}

@scroll-timeline mainProgress {
  time-range: 1s;
   start: selector(#main-title) start 1;
  end: selector(#featured-image) start 0;
}


@scroll-timeline img1Progress {
  time-range: 1s;
  start: selector(#img1) end .5;
  end: selector(#img1) end 1.5;
}

@scroll-timeline img2Progress {
  time-range: 1s;
  start: selector(#img2) end 0.25;
  end: selector(#img2) end 1.25;
}

@keyframes scrollProgress {
  to { transform: translateX(0); }
}

@keyframes circleReveal {
  to {
    clip-path: circle(125%);
  }
}

@keyframes wipeDown {
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes slideUp {
  to {
    transform: translateY(-100%);
  }
}


.progress-bar {
  position: sticky;
  z-index: 15;
  top: 0;
  height: .5rem;
  transform: translateX(100%);
  animation: scrollProgress 1s linear both;
  animation-timeline: bodyProgress;
  background-color: green;
}


#img1 {
  clip-path: circle(0%);
  animation: circleReveal 1s linear both;
  animation-timeline: img1Progress;
}


#img2 {
  clip-path: inset(0 0 100% 0);
  animation: wipeDown 1s linear both;
  animation-timeline: img2Progress;
}

header {
  transform: translateY(0);
  animation: slideUp 1s linear both;
  animation-timeline: mainProgress;
}

@supports not (animation-timeline: mainProgess){
  body {
    position: relative;
    ::after {
      content: "Your browser does not yet support animation-timeline";
      position: absolute;
      background: white;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
    }
  }
  
   * {
      animation: none;
      transform: none;
    }
}
              
            
!

JS

              
                // https://www.youtube.com/watch?v=mzKfetD9YrA
              
            
!
999px

Console