Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.53 KB

README.md

File metadata and controls

54 lines (36 loc) · 1.53 KB

27. CSS Grid

Lay out two-dimensional page areas.

Learn

  • grid tracks
  • fr
  • repeat()
  • minmax()
  • auto placement
  • areas
  • gap

Build

Build a dashboard with sidebar, main content, and responsive cards.

Check your work

  • Open the result in a browser and inspect the HTML and computed CSS.
  • Test at narrow and wide widths and use the keyboard for interactive elements.
  • Write down one thing you changed after testing.

Deep lesson

How it works

Grid creates explicit rows and columns and can place items across both dimensions. fr units share available space; minmax sets useful constraints; repeat and auto-fit help form responsive card tracks. Named areas make a page shell legible. Implicit tracks appear when content exceeds the explicit grid. Use Grid when row and column alignment matter together.

Common mistake

An item can overflow a 1fr track if its minimum content size is too large. minmax(0, 1fr) or min-width:0 can address that specific case.

Guided challenge

Build a header/sidebar/main/footer shell and a nested card grid. Turn on the Grid overlay, then add a long unbroken word and fix any overflow.

Completion check

  • Rebuild the core idea without copying the example line by line.
  • Explain the key HTML or CSS choice in your own words.
  • Test the result at a narrow width and with keyboard navigation where relevant.

Run the example

Open example.html in a browser. Edit style.css, save, and refresh.

Try: Change the sidebar track size and inspect the grid overlay.