property

grid-template-areas — CSS reference

Names rectangular groups of cells using one string per row. Initial none; not inherited. Each row must contain the same number of cell tokens, and every named region must be rectangular. A dot token marks an unnamed cell. Naming an area does not place an item automatically.

Formal Syntax & Structure

css syntaxcss
none | <string>+

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>grid-template-areas</title><style>body{margin:0}#g{display:grid;grid-template-columns:100px 200px;grid-template-rows:40px 50px;grid-template-areas:"head head" "side main";}#g>*{background:#146e73;color:white;box-sizing:border-box}#b{background:#345d8e}#c{background:#79518e}</style><body><div id="g"><header id="a" style="grid-area:head">Header</header><aside id="b" style="grid-area:side">Side</aside><main id="c" style="grid-area:main">Main</main></div></body></html>
CSS Reference