Skip to main content
Web Fundamentals: Assignment 1 is due at the end of week 2.
My College
On this page

CSS Layout

Lay out pages with the box model, flexbox, and grid.

This lesson covers CSS layout techniques. Replace this with your own content.

Flexbox or grid

Both versions lay out .card elements in rows at least 200px wide that wrap on narrow screens. Switch between the tabs to compare them:

CSSFlexbox
.cards {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.card {
flex: 1 1 200px;
}

Topics

  • The box model
  • Flexbox
  • Grid

Last updated: