freecoding.school100% FREE · NO SIGNUP
Grid CanyonISSUE #19 of 27

grid items · grid-area · named lines

FlexboVSThe Float Phantom
Flexbo saysNamed grid areas let you draw the layout as ASCII art with grid-template-areas.

Name regions and lay them out visually: define grid-template-areas with strings like "head head" "nav main", then assign each item grid-area: head. The template literally looks like the layout, making complex structures readable and easy to rearrange per breakpoint.

Power-ups you unlock

The Float Phantom attacks — common mistakes

Boss battleLay out header / sidebar / main / footer using grid-template-areas.

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>.g{display:grid;grid-template-columns:120px 1fr;grid-template-areas:"head head" "nav main" "foot foot";gap:6px}.h{grid-area:head}.n{grid-area:nav}.m{grid-area:main}.f{grid-area:foot}.g>div{color:#e6e0ff;padding:12px;background:#140a28}</style></head><body style="background:#06040d;padding:20px"><div class="g"><div class="h">header</div><div class="n">nav</div><div class="m">main</div><div class="f">footer</div></div></body></html>
▶ Open the interactive comic issue
‹ Grid Items · Column / Row SpanSubgrid · Inheriting Parent Tracks ›