Halloween Sale 15% off Ends in See the plans
SCSS

Equal-Height Card Grid Style (SCSS)

Turns any Columns or Group block with the class "card-grid" into a responsive grid of equal-height cards with shadows and hover lift.

Don’t have WPIDE yet? Install it on your site

Code

$card-min: 240px;
$card-gap: 1.5rem;
$card-radius: 10px;
$card-shadow: 0 2px 10px rgba(0, 0, 0, .08);

.card-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax($card-min, 1fr));
    gap: $card-gap;

    > * {
        display: flex;
        flex-direction: column;
        margin: 0 !important;
        padding: 1.5rem;
        border-radius: $card-radius;
        background: #fff;
        box-shadow: $card-shadow;
        transition: transform .2s ease, box-shadow .2s ease;

        > :last-child {
            margin-top: auto;
        }

        &:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
        }
    }

    @media (prefers-reduced-motion: reduce) {
        > *:hover {
            transform: none;
        }
    }
}

Notes

Add the class card-grid to a Columns block. Adjust $card-min to control how narrow cards get before wrapping.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.