CSS-Only Section Wipes

Written by
Published
Typical Read
1 minutes
Find your next web developer job
Associate Web Developer at Tokio Marine HCC (Houston, TX)

Throw away the JavaScript, put down the libraries, say good-bye to ScrollMagic section wipes, and hello to CSS-only section wipes. Learn how to create scroll wipes with sticky containers.

tl;dr

<section>
  <h2>Section 1</h2>
  <p>Vestibulum id ligula porta felis euismod semper.</p>
</section>
<section>
  <h2>Section 2</h2>
  <p>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
</section>
<section>
  <h2>Section 3</h2>
  <p>Donec id elit non mi porta gravida at eget metus.</p>
</section>
section {
  bottom: 0;
  min-height: 95vh;
  left: 0;
  right: 0;
  position: sticky;
}

section:nth-child(1) {
  background: #000;
  z-index: 3;
}

section:nth-child(2) {
  background: #ccc;
  z-index: 2;
}

section:nth-child(3) {
  background: #fff;
  z-index: 1;
}

Did you find CSS-Only Section Wipes useful? Get articles in your inbox.

…and don’t worry, I hate spam as much as you. Expect to hear from me at most once a week.

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on facebook

Stay updated.

Get a weekly email with the latest trends in web development & SEO.

Write a guest post.

Have an interesting article or idea? Become a guest blogger & pitch me your concept today.

Join the conversation.

Your email address will not be published. Required fields are marked *

All comments posted on 'CSS-Only Section Wipes' are held for moderation and only published when on topic and not rude. Get a gold star if you actually read & follow these rules.

You may write comments in Markdown. This is the best way to post any code, inline like `<div>this</div>` or multiline blocks within triple backtick fences (```) with double new lines before and after.

Want to tell me something privately, like pointing out a typo or stuff like that? Contact Me.