CSS Portal

CSS grid-area Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
grid-area
CSS PropertyThis property is supported by all modern browsers.
Updated 1st January 2026

Description

The grid-area property is used on grid items to control where an item sits in the grid and how many tracks it covers. It acts as a compact way to define both the item's placement by grid lines and its association with named template areas, so authors can position elements either by explicit line references or by matching names declared on the grid container. Because it sets both row and column placement in one declaration, it is a convenient tool when you want to describe an item's footprint in the layout in a single place.

Conceptually, grid-area maps to the item's row and column start/end boundaries and therefore ties into the row- and column-related placement properties; see grid-row and grid-column. That relationship means changes to the grid’s track sizing or to the named areas on the container can change how a previously specified area behaves, because the item’s extent is defined relative to the grid’s lines and named regions. Using it to span multiple rows or columns causes the grid item to occupy the combined space of those tracks, which in turn affects layout flow, available space for neighboring items, and automatic track sizing.

In practice, grid-area interacts with the grid container’s area definitions and the auto-placement algorithm: if an item’s name corresponds to a named area on the container, it will be placed into that area; otherwise explicit line placements take effect and the auto-placement rules resolve conflicts or free slots. It does not control an item’s alignment inside its assigned grid area — that is handled by properties such as justify-self and align-self — and it is only meaningful when the parent is a grid (see display for grid container types).

Definition

Initial value
See individual properties
Applies to
Grid items and absolutely-positioned boxes whose containing block is a grid container
Inherited
No
Computed value
See individual properties
Animatable
Yes
JavaScript syntax
object.style.gridArea

Interactive Demo

Grid Area

Syntax

grid-area: grid-row-start / grid-column-start / grid-row-end / grid-column-end |  itemname

Values

Example

<div class='grid'>
<header class='header'>Header</header>
<nav class='nav'>
<ul class='menu'>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
<main class='main'>
<h1>Main Content</h1>
<p>This area uses the grid-area named 'main'.</p>
</main>
<aside class='sidebar'>
<h2>Sidebar</h2>
<p>Extra info here.</p>
</aside>
<footer class='footer'>Footer © 2026</footer>
</div>
.grid {
  display: grid;
  grid-template-columns: 200px 1fr 250px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    'header header header'
    'nav main sidebar'
    'footer footer footer';
  gap: 16px;
  height: 100vh;
  padding: 16px;
  box-sizing: border-box;
  background: #f4f6f8;
}

.header {
  grid-area: header;
  background: #2b7a78;
  color: #ffffff;
  padding: 16px;
  border-radius: 8px;
}

.nav {
  grid-area: nav;
  background: #17252a;
  color: #ffffff;
  padding: 16px;
  border-radius: 8px;
}

.main {
  grid-area: main;
  background: #def2f1;
  padding: 16px;
  border-radius: 8px;
}

.sidebar {
  grid-area: sidebar;
  background: #3aa17e;
  color: #ffffff;
  padding: 16px;
  border-radius: 8px;
}

.footer {
  grid-area: footer;
  background: #17252a;
  color: #ffffff;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

/* Responsive: collapse to single column on small screens */
@media (max-width: 700px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      'header'
      'nav'
      'main'
      'sidebar'
      'footer';
  }
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS grid-area property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee