grid-template-areas

W3C CSS Snapshot 2026

Draw the grid as named areas. Write each row in quotes and keep each area rectangular.

On this page

Syntax and values

Value or syntaxWhat it does
noneThe initial value. Creates no named areas.
"head head" "side main"Two rows, with a heading area spanning both columns in row one.
"side ."A dot is an empty cell.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>grid-template-areas example</title>
  <style>
.layout { display: grid; width: min(100%, 320px); border: 2px solid teal; box-sizing: border-box; }
.layout > div { padding: 8px 12px; background: #def5f5; color: #123; border: 1px solid #81b9b5; box-sizing: border-box; }
.layout { grid-template-columns: 1fr 2fr; grid-template-areas: "head head" "side main"; }
.first { grid-area: head; }
.second { grid-area: side; }
.layout > div:last-child { grid-area: main; }
  </style>
</head>
<body>
<div class="layout">
  <div class="first">A</div>
  <div class="second">B</div>
  <div>C</div>
</div>
</body>
</html>

What to expect A spans the heading row. B and C share the next row.

Official references