How to make equal height columns using CSS

Before Flexbox became popular, creating CSS equal height columns was surprisingly annoying. Developers used floats, fake table layouts, and sometimes even JavaScript just to make columns line up properly.

Thankfully, modern CSS makes this much easier today.

In this tutorial, you’ll learn multiple ways to create equal height columns using CSS, including Flexbox and Grid — with practical examples you can use in real projects.

Why Equal Height Columns Matter

Equal height columns make layouts look:

  • cleaner
  • more professional
  • balanced

They are commonly used in:

  • pricing tables
  • card layouts
  • blog grids
  • dashboard designs

Method 1: How to Create CSS Equal Height Columns Using Flexbox

Flexbox is the easiest and most modern solution.

In most real-world projects, Flexbox is usually the fastest way to solve equal height layout problems.

HTML

CSS

How It Works

When using:

all child elements automatically stretch to the same height.

This is why Flexbox is the preferred solution.

Result

Both columns become equal height automatically — even if the content length is different.

If you inspect modern websites today, you’ll notice that Flexbox is used almost everywhere for card layouts and UI alignment.

Method 2: Equal Height Columns Using CSS Grid

CSS Grid is another excellent modern approach.

CSS

Grid items naturally stretch to equal height in the same row.

When to Use Grid Instead of Flexbox

Use Grid when:

  • Building full page layouts
  • Creating complex responsive grids
  • Working with rows and columns together

Use Flexbox when:

  • Aligning small UI components
  • Building navbars
  • Creating card rows

Method 3: Equal Height Cards Layout

This is a practical real-world example.

HTML

CSS

Responsive Equal Height Column

For mobile responsiveness:

This allows columns to stack on smaller screens.

Common Mistakes

1. Not Using display:flex

Without Flexbox, equal heights usually won’t work automatically.

2. Adding Fixed Heights

Avoid this:

Avoid fixed heights unless you absolutely need them. They often create spacing issues on smaller screens and can break responsive layouts.

3. Forgetting flex:1

This helps columns share equal width.

Flexbox vs Old CSS Methods

Older methods included:

  • Floats
  • Table layouts
  • JavaScript height matching

Modern CSS Flexbox replaces all of these with much cleaner code.

Browser Support

Flexbox and Grid are supported in all modern browsers including:

  • Chrome
  • Firefox
  • Edge
  • Safari

Best Method in 2026

✅ Recommended:

Use Flexbox for equal height columns

For most layouts, I’d recommend using Flexbox first because it’s simpler and easier to debug.

It is:

  • Simple
  • Responsive
  • Widely Supported
  • Easy to Maintain

Where You’ll Actually Use This

CSS equal height columns are commonly used in:

  • Pricing tables
  • Feature cards
  • Blog post grids
  • Dashboard widgets
  • SaaS landing pages

Frequently Asked Questions (FAQ)

Q1. How do I make all columns the same height in CSS?

Use Flexbox:

Q2. Does CSS Grid create equal height columns automatically?

Yes. Grid items in the same row stretch equally by default.

Q3. Should I use JavaScript for equal height columns?

No. Modern CSS handles this easily without JavaScript.

Final Thoughts

Creating CSS equal height columns used to require hacks and unnecessary complexity. Today, Flexbox and Grid make this problem much easier to solve.

For most projects, Flexbox is usually the quickest and cleanest solution. Once you start using it regularly, building responsive layouts becomes much more enjoyable.

For most layouts:

  • Use Flexbox for simple rows
  • Use Grid for complex layouts

Once you understand these techniques, building responsive layouts becomes much easier.

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.