Skip to content
The Admin Bar
  • Get Involved
    • Facebook Group
    • Barfly Community
    • TABLE Mastermind
  • Learn
    • Articles
    • Events
    • Newsletter
    • YouTube
    • WordPress Professionals Survey
    • SEO Weekly
    • Security Weekly
    • Accessibility Weekly
  • Products
    • The Paid Discovery Class
    • Website Owner’s Manual
    • Agency Copilot
    • Website Pricing Calculator
    • Agency Airtable Pack
    • Prospect Pipeline Challenge
    • Easy-Peasy Proposal
    • TAB Swag
  • About
  • Free Stuff

How to Create Stacking Cards with CSS in GenerateBlocks

Recently, I came across a cool stacking card effect on a website my friend Paul launched. The cards appeared to stack and fade into the background as you scrolled, creating a dynamic …

Kyle Van Deusen

Published:

March 4, 2025

Filed Under:

General

Kyle Van Deusen

The Admin Bar

After spending 15 years as a graphic designer and earning a business degree, I launched my agency, OGAL Web Design, in 2017. A year later, after finding the amazing community around WordPress, I co-found The Admin Bar, which has grown to become the #1 community for WordPress professionals. I'm a husband and proud father of three, and a resident of the Commonwealth of Virginia.

3d stacking
This content contains affiliate links. View our affiliate disclaimer.

Recently, I came across a cool stacking card effect on a website my friend Paul launched. The cards appeared to stack and fade into the background as you scrolled, creating a dynamic and visually appealing effect. Inspired by this, I decided to experiment and create my own version using GenerateBlocks and a few lines of CSS.

What’s great about this effect is that it’s CSS-only, lightweight, and easy to implement. In this post, I’ll walk you through how to set it up step by step.

YouTube video

Step 1: Setting Up the Layout

Before we dive into the CSS, let’s set up the basic structure of the page.

The Section and Cards

  1. Create a Section:
    • Add a container for the stacking cards.
    • Set the max width to your site’s content width (e.g., a CSS variable like --content-width).
    • Center the section by setting the left and right margins to auto.
  2. Set Up Flexbox:
    • Change the section’s display to flex.
    • Set the flex direction to column.
    • Add a row gap of 24px to space out the cards.
  3. Add the Cards:
    • Insert four containers inside the section, one for each card.
    • These containers will hold the content for each card.

At this point, you should have a basic layout with four stacked cards.

Step 2: Making the Cards Sticky

To create the stacking effect, we’ll use sticky positioning.

  1. Set the Section’s Position:
    • Select the section container and set its position to relative.
    • This ensures the sticky cards will stick relative to this section.
  2. Add a Class to the Cards:
    • Assign a class (e.g., stack-card) to all four cards.
    • This will allow us to style and animate them collectively.
  3. Set Sticky Positioning for the Cards:
    • Go to the stack-card class and set the position to sticky.
    • Set the top value to match the section’s top padding (e.g., 80px).

At this point, the cards will stick to the top of the section as you scroll.

Step 3: Adding the Animation

Now that the cards are sticky, let’s add some animation to make them fade and scale as they stack.

Writing the CSS

  1. Target the Cards:
    • Open the Additional CSS section in the WordPress customizer.
    • Add the following CSS:
.stack-card {
  animation: stack;
  animation-timeline: view(auto calc(100% - 80px));
}

@keyframes stack {
  to {
    filter: blur(20px);
    transform: scale(0.5);
  }
}

Explanation

  • Animation:
    • The stack animation is applied to each card.
    • The animation-timeline uses a view() function to control when the animation occurs.
  • Keyframes:
    • The to declaration defines the final state of the animation:
      • filter: blur(20px) blurs the card.
      • transform: scale(0.5) shrinks the card to 50% of its size.

Step 4: Adding Accessibility

Whenever you add animations, it’s important to consider accessibility. Some users may prefer reduced motion, so we’ll wrap the animation in a prefers-reduced-motion media query.

@media (prefers-reduced-motion: no-preference) {
  .stack-card {
    animation: stack;
    animation-timeline: view(auto calc(100% - 80px));
  }

  @keyframes stack {
    to {
      filter: blur(20px);
      transform: scale(0.5);
    }
  }
}

This ensures that users with reduced motion preferences will see the cards stack without the animation.

Step 5: Using CSS Variables

To make the effect more maintainable, we can use a CSS variable for the padding value (e.g., 80px).

  1. Define the Variable:
    • Add the following to the :root selector:
:root {
  --stack-padding-top: 80px;
}
  1. Update the CSS:
    • Replace the hardcoded 80px with the variable:
.stack-card {
  animation-timeline: view(auto calc(100% - var(--stack-padding-top)));
}
  1. Update the Editor:
    • Replace the 80px values in the editor (e.g., section padding and sticky top value) with the variable:
var(--stack-padding-top)

Now, if you need to change the padding, you only have to update the variable in one place.

Step 6: Testing Responsiveness

The stacking effect works great on mobile, but you’ll need to ensure the cards aren’t too tall. If a card’s height exceeds the viewport, users may not be able to scroll through its content before it fades away.

  1. Check Card Heights:
    • Ensure the cards fit within the viewport on smaller screens.
  2. Test the Effect:
    • Scroll through the section on both desktop and mobile to confirm the effect works as expected.

Browser Support

The view transitions used in this effect don’t have perfect browser support yet. As of now, they’re supported in Chromium-based browsers (e.g., Chrome, Edge) but not in Firefox or Safari.

Since this is a progressive enhancement, users on unsupported browsers will still see the cards stack without the animation.

Wrapping Up

This stacking card effect is a simple yet powerful way to add visual interest to your website. With just a few lines of CSS, you can create a dynamic, interactive section that works across devices.

While browser support for view transitions is still growing, this effect is a great example of progressive enhancement. It works beautifully in supported browsers and degrades gracefully in others.

I hope this tutorial inspires you to experiment with CSS animations in your own projects. Let me know how you plan to use this effect—I’d love to see what you create!

Share This Article!
FacebookXLinkedInEmail

Kyle Van Deusen

The Admin Bar

After spending 15 years as a graphic designer and earning a business degree, I launched my agency, OGAL Web Design, in 2017. A year later, after finding the amazing community around WordPress, I co-found The Admin Bar, which has grown to become the #1 community for WordPress professionals. I'm a husband and proud father of three, and a resident of the Commonwealth of Virginia.

Come Join Us!

Join the #1 WordPress Community and dive into conversations covering every aspect of running an agency!

Join Group

Kyle Van Deusen

Community Manager

Latest Events

January 20th, 2026

Revolutionizing How Small Agencies Grow Their Business Efficiently

September 16, 2025

Termageddon 2.0

Better Tools, Smoother Workflows, Happier Clients

August 19th, 2025

Which WordPress Page Builder is the Most Accessible?

The 2025 Page Builder Accessibility Report
Tpdc onblue

Learn a proven discovery framework to transform casual leads into high-paying clients.

View the Course
The Friday Chaser

Wash down the week with the best of The Admin Bar! News, tips, and the best conversations delivered straight to your inbox every Friday!

Subscribe Today

More Articles

December 15, 2025

Abby Wood Joins Barfly’s as Community Bartender

TAB is welcoming Abby Wood as Community Bartender for Barflies, focused on deeper connections, better conversations, and a stronger member experience.

Toaster with two toasted bread slices ready to serve, close-up photo for breakfast or kitchen themes.
December 2, 2025

Standing Out to Get Hired: The Biggest Advantage is an Authentic Brand Voice (Yes, Really)

AI is everywhere, but authenticity still wins. Learn how a genuine brand voice helps your clients stand out & build trust in an era filled with generic AI copy.

Barfly profile erika dickstein
November 19, 2025

Member Spotlight: Erika Dickstein

Erika Dickstein doesn’t just build websites — she helps businesses find their spark and translate it …

2025phone

Join the #1 WordPress Community

The Admin Bar community is at the heart of what we do. Join in on the daily conversation and get involved.

Request Membership
The Admin Bar logo.

Explore

Community

Events

Articles

Products

Newsletter

Agency Report Card

Care Plan Toolkit

Noted!

Barfly Login

Policies

Privacy Policy

Terms of Service

Affiliate Agreement

Affiliate Disclaimer

Accessibility Statement

Privacy Settings

Misc.

Advertise

Login

Contact

© 2017-2025 The Admin Bar (a Division of OGAL Web Design) — All Rights Reserved

The Admin Bar logo.
  • Get Involved
    • Facebook Group
    • Barfly Community
    • TABLE Mastermind
  • Learn
    • Articles
    • Events
    • Newsletter
    • YouTube
    • WordPress Professionals Survey
    • SEO Weekly
    • Security Weekly
    • Accessibility Weekly
  • Products
    • The Paid Discovery Class
    • Website Owner’s Manual
    • Agency Copilot
    • Website Pricing Calculator
    • Agency Airtable Pack
    • Prospect Pipeline Challenge
    • Easy-Peasy Proposal
    • TAB Swag
  • About
  • Free Stuff
YouTube Facebook
Sell More Care Plans