Skip to content

Stacking cards on scroll in WordPress

Step cards that stick to the top of the screen and stack on top of each other while scrolling, with no script.

Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in WordPress

effet-cartes-empilees-defilement.php
<?php
/**
 * Plugin Name: Forge, Cartes empilées au défilement
 * Description: Des cartes d’étapes qui restent collées en haut de l’écran et s’empilent les unes sur les autres pendant le défilement, sans script. Ajoute la composition « Cartes empilées au défilement » à l'éditeur de blocs.
 * Version: 1.0.0
 * Requires at least: 6.6
 * Requires PHP: 8.1
 * Author: Forge
 * License: GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: forge-effet-cartes-empilees-defilement
 *
pattern.html
<!-- wp:group {"tagName": "section", "className": "efce", "layout": {"type": "default"}} -->
<section class="wp-block-group efce"><!-- wp:group {"tagName": "header", "className": "efce-head", "layout": {"type": "default"}} -->
<header class="wp-block-group efce-head"><!-- wp:paragraph {"className": "efce-eyebrow"} -->
<p class="efce-eyebrow">Rénovation Duval &amp; fils · Tours</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level": 2, "className": "efce-title", "anchor": "efce-titre"} -->
<h2 class="wp-block-heading efce-title" id="efce-titre">Votre rénovation, en quatre étapes</h2>
<!-- /wp:heading --></header>
<!-- /wp:group -->
<!-- wp:html -->
<ol class="efce-list">
          <li class="efce-card" style="--efce-i: 0">
style.css
:root {
  --efce-bg: #f2f4f7;
  --efce-text: #16202c;
  --efce-muted: #4a5666;
  --efce-card: #ffffff;
  --efce-line: #d9dfe7;
  --efce-num: #1d4ed8;
  --demo-effet-cartes-empilees-defilement-bg: #e7ebf0;
  --demo-effet-cartes-empilees-defilement-text: #16202c;
}

@media (prefers-color-scheme: dark) {

Free component: copy it freely, including for commercial projects.

Visual effects components in WordPress
  • Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A paragraph whose words turn from grey to full ink, one by one, as the page scrolls, in pure CSS with a plain-text fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four offset, translucent sine waves gently roll along the bottom of a section, each at its own pace.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component