CSS grid-template-areas Property

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The grid-template-areas property names regions on a grid container. Each quoted string is one row of cell names. Items land in those regions with grid-area (or the line longhands).

The initial value is none. Set it on a grid container (display: grid). Pair it with grid-template-rows and grid-template-columns for sizes, or use the grid-template shorthand.

Standard-track.

Not deprecated and not experimental. Baseline widely available with CSS Grid.

CSS Syntax

syntax.css
grid-template-areas: none | <string>+ | initial | inherit;

One string per row. Tokens inside a string are cell names (or . for empty).

Property Values

ValueDescriptionTry it
noneDefault. No named areasTry it
<string>+One quoted string per row of area namesTry it
. tokenEmpty / unnamed cell (one or more dots)Try it
Same name spanRepeated names merge into one rectangular areaTry it
initialResets to noneTry it
inheritTakes the parent value (not inherited by default)Try it

How to Use grid-template-areas

Sketch the layout in strings, then assign children by name.

  1. Set display: grid on the container.
  2. Write one quoted string per row (same cell count in every row).
  3. Repeat a name to span; use . for empty cells.
  4. Place items with grid-area: name matching those tokens.
MapMeaning
"a a" "b c"Wide a on top; b and c below
"a ." "b c"Empty cell beside a
"a a a" "b b c"Full-width header; b spans two columns

Live Preview

Change only grid-template-areas. Items keep grid-area: a, b, and c.

With none, named areas disappear and items fall back to auto-placement.

Areas
a
b
c

grid-template-areas: header + two

CSS Examples

Each snippet focuses on grid-template-areas. Use Try It Yourself for a live editor.

Example 1 — Named Areas

Two strings draw two rows. Place items with matching grid-area names.

CSS
<style>
  .grid {
    display: grid;
    grid-template-areas:
      "a a"
      "b c";
  }
  .a { grid-area: a; }
  .b { grid-area: b; }
  .c { grid-area: c; }
</style>

<div class="grid">
  <div class="a">a</div>
  <div class="b">b</div>
  <div class="c">c</div>
</div>
Try It Yourself

How It Works

  1. One string = one row. "a a" is the first row; "b c" is the second.
  2. Same name merges. Two a tokens make a wide header cell.
  3. Columns follow the tokens. Each row has two cells, so the grid has two columns.
  4. Hook items up. grid-area: a places that child into the a region.

Example 2 — Empty Cells with .

A period leaves a cell unnamed so nothing claims it by area name.

CSS
<style>
  .grid {
    display: grid;
    grid-template-areas:
      "a ."
      "b c";
  }
  .a { grid-area: a; }
  .b { grid-area: b; }
  .c { grid-area: c; }
</style>

<div class="grid">
  <div class="a">a</div>
  <div class="b">b</div>
  <div class="c">c</div>
</div>
Try It Yourself

How It Works

  1. Null token. . (or ...) marks an empty cell.
  2. Gap in the map. Top-right has no area name, so it stays blank.
  3. Other names still work. a, b, and c place as usual.
  4. Rows stay aligned. Every string still has two tokens.

Example 3 — Spanning Names

Repeat a name across cells to grow a rectangular region.

CSS
<style>
  .grid {
    display: grid;
    grid-template-areas:
      "a a a"
      "b b c";
  }
  .a { grid-area: a; }
  .b { grid-area: b; }
  .c { grid-area: c; }
</style>

<div class="grid">
  <div class="a">a</div>
  <div class="b">b</div>
  <div class="c">c</div>
</div>
Try It Yourself

How It Works

  1. Full-width header. Three a tokens in a row make area a span all columns.
  2. Partial span. Two b tokens make b cover the first two columns of row two.
  3. Must be a rectangle. Spanned cells for one name must form a solid block.
  4. Three columns. The longest row token count sets the column count.

Edge Cases & Pitfalls

Invalid maps drop the whole property. Keep rows even and spans rectangular.

rectangle

Non-rectangular names are invalid

An L-shape or hole for one name makes the declaration invalid. Every named area must be a solid rectangle.

rows

Every string needs the same cell count

Uneven rows (for example "a a" then "b") invalidate the areas map.

dot

. is empty, not a name

You cannot write grid-area: .. Dots only leave gaps in the template.

sizes

Areas name cells; they do not size them

Track sizes still come from grid-template-rows, grid-template-columns, or the grid-template shorthand.

place

Names alone do not move items

Defining a in the map does nothing until a child uses grid-area: a (or matching line longhands).

Browser Support

grid-template-areas is a browser style property for CSS Grid. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

grid-template-areas

Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+, Opera, Samsung Internet 6+. Not supported in Internet Explorer.

96% global support
Google Chrome 57+
Full support
Mozilla Firefox 52+
Full support
Apple Safari 10.1+
Full support
Microsoft Edge 16+
Full support
Opera 44+
Full support
Samsung Internet 6+
Full support
Internet Explorer All
Not supported
grid-template-areas Supported with modern CSS Grid

Bottom line: Safe for modern grid layouts. No vendor prefix is required in current browsers.

Key Takeaways

  • Role: name rectangular regions on the grid with strings.
  • Place items: grid-area: name matches a token in the map.
  • Empty cells: use . (or more dots) as a null token.
  • Invalid maps fail: uneven rows or non-rectangular names drop the value.

One line: grid-template-areas draws a named layout map; grid-area seats each item in that map.

Frequently Asked Questions

It names regions on a grid container with quoted strings. Each string is one row of cell names. Items use those names via grid-area.
none — the container defines no named grid areas.
Use a null cell token: a single . or several dots (..., .....). That cell has no area name.
A named area must be a solid rectangle. L-shapes or holes make the whole declaration invalid.
grid-template-areas sets only the name map. grid-template can set areas plus row and column sizes in one shorthand.
Baseline widely available: Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+. It is a browser style property, not a Node.js feature.

Next: grid-template-columns

Size column tracks for the areas you just named.

grid-template-columns tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful