Sub topic 1
Why Pages Use a Column Grid
Prerequisites
This chapter assumes you know basic HTML structure (elements and classes), basic CSS syntax (selectors, properties, and units such as px, rem, and %), and the CSS box model (margin, padding, width). You do not need any CSS Grid knowledge yet. Later chapters build the grid in code.
What a column grid does
A column grid divides the width of a page into repeating vertical tracks. Designers place content so its edges line up with those tracks. The grid is a layout guide. Visitors never see it, but they notice its effects: headings, images, and text blocks share edges, and the page looks ordered.
A grid gives a layout three practical benefits:
- Alignment. Elements that start and end on the same column lines look related, and the eye finds content faster.
- Consistency. Every page of a site reuses the same column count and spacing, so new pages need no fresh layout decisions.
- Flexibility. A sidebar can take 4 columns and the main text 8. A card can take 3 columns or 6. The system stays the same while the proportions change.
The three parts
Every column grid is made of three measurements. Later chapters cover each in detail. For now, learn the names.
| Part | What it is | Example value |
|---|---|---|
| Columns | The repeating tracks that hold content | 12 columns |
| Gutters | The empty space between neighboring columns | 1.5rem |
| Margins | The empty space between the grid and the edge of the viewport | 1rem |
Content sits inside columns. Gutters keep neighboring items from touching. Margins keep the whole layout away from the screen edge.
A first look at the result
The markup below has two items inside a grid. The CSS in a later chapter will make the main area span 8 columns and the sidebar span 4. Here is the markup you will use.
<div class="page">
<div class="grid">
<main class="main">Main content</main>
<aside class="sidebar">Sidebar</aside>
</div>
</div>Without a grid, you would size these two blocks with percentages and then adjust margins by hand. That works for one page. It breaks down when the next page needs three blocks, or when the screen gets narrower, because every width and gap must be recalculated. With a grid, you change only the number of columns each item spans.
Why twelve columns is common
Twelve divides evenly by 2, 3, 4, and 6. That lets a layout split into halves, thirds, quarters, or sixths using the same grid. Other counts are valid. Four columns suit phones, and eight suit tablets. The right count depends on the layouts you need, and you will choose one in the next chapters.
Common mistakes at this stage
- Treating the grid as visible decoration. The grid exists to position content. If readers can see it, something is wrong.
- Mixing unrelated spacing values. If one section uses 20px gaps and another uses 1.5rem, the alignment benefit disappears. Pick one gutter value and reuse it.
- Choosing a column count before knowing the layouts. Start from what the page must hold, such as a main area, a sidebar, and cards, then pick a count that divides cleanly.
Exercise
Name the three parts of a column grid and say what each one controls.
Show answer
Columns are the repeating tracks that hold content. Gutters are the space between neighboring columns. Margins are the space between the grid and the edge of the viewport.
Exercise
A designer wants layouts that split into halves, thirds, and quarters from one grid. Why is a 12-column grid a good choice?
Show answer
Twelve divides evenly by 2, 3, 4, and 6, so items can span 6, 4, 3, or 2 columns and still fill the row exactly. Half is 6 columns, a third is 4, and a quarter is 3.