Explicit placement and named areas
Definition and purpose
Grid placement assigns items to lines or named areas. Use explicit placement for meaningful layout regions, while retaining a source order that reads naturally without the visual grid.
Span two columns
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; } #p { width: 300px; } #p > div { background: lightblue; outline: 1px solid navy; } #p { display: grid; grid-template-columns: 100px 190px; grid-template-rows: 40px 50px; gap: 10px; } #a { grid-column: 1 / 3; } </style> </head> <body> <div id="p"> <div id="a">A</div> <div id="b">B</div> <div id="c">C</div> </div> </body></html>A spans the full width, including the intervening gap.
Syntax and mental model
grid-column: 1 / 3 spans from line 1 to line 3, crossing two columns. grid-template-areas uses quoted rows of names; each named region must form a rectangle. grid-area: name assigns an item to that region.
Name page regions
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; } #p { width: 300px; } #p > div { background: lightblue; outline: 1px solid navy; } #p { display: grid; grid-template-columns: 100px 190px; grid-template-rows: 40px 50px; gap: 10px; grid-template-areas: "head head" "nav main"; } #a { grid-area: head; } #b { grid-area: nav; } #c { grid-area: main; } </style> </head> <body> <div id="p"> <div id="a">A</div> <div id="b">B</div> <div id="c">C</div> </div> </body></html>Named areas produce the same geometry with descriptive region names.
Common mistakes
Do not confuse the end line with the last covered track. Repeated names must form rectangles; inconsistent row lengths invalidate the template. Visual placement does not normally change focus order.
Practice and next steps
After trying the examples, complete the linked coding exercise and review questions. Predict the result before running your code. Prerequisite: Fractional tracks and minmax. Next lesson: Implicit tracks and auto-placement.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Explicit placement and named areas — knowledge check
Five questions on explicit placement and named areas.
How many columns does grid-column: 1 / 3 span?
What shape must a named area form?
Which property assigns an item to a named area?
What happens to a template with different row token counts?
Does visual grid placement normally change tab order?