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

              
                <div class="warning">
  <p>⚠️ Your browser does not support CSS Scroll-Linked Animations, so this demo won't work. If you're feeling adventurous use Chrome 89 with “Experimental Web Platform Features” enabled. Alternatively you can <a href="https://codepen.io/bramus/full/PobKXRj" target="_top">check out a version that uses JavaScript</a></p>
</div>
<main id="main">
  <aside class="stuck">
    <h1>
      <span invisible>x</span>
      <span class="slash">/</span>
      <span> 4</span>
    </h1>
  </aside>
  <section>
    <h1>
      <span>1</span>
      <span invisible class="slash">/</span>
      <span invisible>4</span>
    </h1>
  </section>
  <section>
    <h1>
      <span>2</span>
      <span invisible class="slash">/</span>
      <span invisible>4</span>
    </h1>
    </div>
  </section>
  <section>
    <h1>
      <span>3</span>
      <span invisible class="slash">/</span>
      <span invisible>4</span>
    </h1>
    </div>
  </section>
  <section>
    <h1>
      <span>4</span>
      <span invisible class="slash">/</span>
      <span invisible>4</span>
    </h1>
    </div>
  </section>
</main>
              
            
!

CSS

              
                /*
Forked from https://codepen.io/argyleink/pen/XWdNYaY by @argyleink

Adjustments:
- Uses mix-blend-mode instead of clip, resulting in a lighter markup

*/

@supports (animation-timeline: works) {
  
  @scroll-timeline spin-slash {
    source: selector(#main);  
    time-range: 1s;
  }

  @keyframes rotato {
    to {
      transform: rotateZ(3turn);
    }
  }

  .slash {
    animation: rotato 1s linear;
    animation-timeline: spin-slash;
  }
  
  .warning {
    display: none;
  }

}


main {
  max-block-size: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
}

section {
  block-size: 100vh;
  inline-size: 100vw;
  scroll-snap-align: start;
  display: grid;
  place-content: center;
  position: relative;
}

section:nth-of-type(odd) {
  background: black;
  color: white;
}

h1 {
  font-variant-numeric: tabular-nums;
  font-size: 25vmin;
  font-weight: 300;
  display: flex;
  align-items: center;
  flex-gap: 0.5ch;
}

.slash {
  font-family: Roboto, monospace;
}

.stuck {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  pointer-events: none;
  color: #fff;
  mix-blend-mode: difference;
} 

.stuck > h1 {
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  will-change: transform;
  place-content: center;
  grid-auto-flow: column;
}

[invisible] {
  visibility: hidden;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: #fff;
}

body {
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

main {
  font-weight: 400;
}

.warning {
  position: fixed;
  bottom: 1em;
  right: 1em;
  left: 1em;
	padding: 1em;
	border: 1px solid #fff;
  z-index: 1;
  text-align: center;
  color: #fff;
  mix-blend-mode: difference;
}

.warning a {
  color: #fff;
}

.warning p {
	margin: 0;
	padding: 0;
}

              
            
!

JS

              
                
              
            
!
999px

Console