Sub topic 1
Why Pages Use a Column Grid
Prerequisites
This chapter assumes you know basic HTML structure, CSS selectors and properties, common units such as rem and %, and the CSS box model.
Why Pages Use a Column Grid
A column grid is a set of repeating vertical tracks that helps content line up. Designers use grids to create rhythm and predictability across a page. Headings, text, images, and sidebars can share alignment lines instead of being positioned independently.
A grid also makes responsive design easier. The same content can span different numbers of columns as the viewport changes. This is usually more reliable than assigning unrelated widths to every element.
The Parts of a Grid
A practical grid has three parts:
| Part | Meaning | Typical decision |
|---|---|---|
| Columns | Vertical tracks that hold content | Count and flexible width |
| Gutters | Space between neighboring columns | Consistent gap |
| Margins | Space outside the grid | Viewport padding and centering |
The grid usually sits inside a container. A container is an element with a maximum width that prevents very long lines on wide screens. It can be centered with equal auto margins and protected from the viewport edge with horizontal padding.
Columns: Choosing a Count and Width
Choose a column count based on the layouts you need, not on a universal rule. Twelve columns are common because they divide evenly into halves, thirds, and quarters. A four-column mobile grid may be easier to use when space is limited.
Columns can be fixed or fluid. Fixed columns keep a stable width, while fluid columns share available space. CSS Grid’s fr unit represents a fraction of the remaining space, making fluid columns practical.
For example, a 12-column grid lets a main region span eight columns and a sidebar span four. The content remains aligned even when the container grows.
Gutters: The Space Between Columns
Gutters separate content and prevent neighboring regions from appearing crowded. Set them consistently within a layout. A narrow screen may need a smaller gutter, while a wide screen can support more space.
Do not confuse a gutter with an outer margin. A gutter appears between columns. A margin appears outside the grid. Inconsistent use of these spaces often produces misaligned edges and uneven visual rhythm.
Exercise
Why might a 12-column grid be useful for a page with a main article and sidebar?
Show answer
The article can span eight columns and the sidebar four, while both remain aligned to the same grid.