The grid-area property places a grid item by line numbers or assigns it to a named region in your layout.
01
Line numbers
Row & column.
02
Named areas
header, main.
03
Span cells
Cover 2×2.
04
Shorthand
Four values.
05
auto
Default flow.
06
Placement
Item control.
Fundamentals
Introduction
The grid-area property in CSS is used to define a grid item's size and location within a grid layout. It is a shorthand property that can combine grid-row-start, grid-column-start, grid-row-end, and grid-column-end.
This property provides an efficient way to place and size grid items, making it easier to design complex grid layouts.
Definition and Usage
Apply grid-area on a child of a grid container (an element with display: grid). Use line numbers when you need precise control over which cells an item covers. Use a name like grid-area: header when the parent defines regions with grid-template-areas.
💡
Beginner Tip
Grid lines are numbered starting at 1, not 0. Line 1 is the left or top edge of the grid. So grid-area: 2 / 1 / 4 / 3 starts at row line 2 and ends at row line 4.
Foundation
📝 Syntax
The syntax for the grid-area property can take two forms: the shorthand form or using grid line names.
The default value for grid-area is auto / auto / auto / auto, which means the grid item will be placed in the next available cell according to the grid's flow.
Syntax Rules
Applies to grid items (children of a grid container), not the container itself.
The hero area name appears twice in the first row of grid-template-areas, so the hero element stretches across both columns.
A11y
♿ Accessibility
Keep logical DOM order even when grid-area visually repositions items.
Use semantic HTML (header, main, nav) alongside named areas.
Test keyboard focus order when grid placement changes on responsive breakpoints.
Do not rely on position alone to convey meaning or hierarchy.
Ensure readable content width in spanned grid cells on large screens.
🧠 How grid-area Works
1
Parent defines the grid
The container sets columns, rows, and optional grid-template-areas.
Grid container
2
Item gets grid-area
You set line numbers or a name on the child element to target its placement.
Declaration
3
Browser maps to cells
The item stretches across the rows and columns bounded by the start and end lines.
Placement
=
▦
Precise item placement
Grid items occupy exactly the cells or named regions you specify.
Compatibility
🖥 Browser Compatibility
The grid-area property is well-supported in modern browsers, including recent versions of Chrome, Firefox, Safari, Edge, and Opera. Test grid layouts across browsers when using complex placement.
✓ Baseline · Universal support
grid-area everywhere
Line numbers and named areas work in every major modern browser.
97%Modern browser support
Google Chrome57+ · Desktop & Mobile
Full support
Mozilla Firefox52+ · Desktop & Mobile
Full support
Apple Safari10.1+ · macOS & iOS
Full support
Microsoft Edge16+ · 79+ Chromium
Full support
Opera44+
Full support
grid-area property97% supported
Bottom line:grid-area is safe for modern projects. Pair with display: grid on the parent container.
Wrap Up
🎉 Conclusion
The grid-area property is a powerful tool for creating flexible and complex grid layouts in CSS. By using this property, you can precisely control the placement and sizing of grid items, allowing for more creative and organized web designs.
Experiment with different grid configurations and see how grid-area can enhance your layout designs. Start with line numbers for spanning cells, then use named areas for readable page layouts.
grid-area places and sizes a grid item by setting where its row and column start and end, or by assigning it to a named area from grid-template-areas.
The default is auto for all four sides, which means the item is placed in the next available cell according to the grid auto-placement flow.
grid-template-areas defines named regions on the grid container. grid-area assigns an individual item to one of those named regions, or sets line numbers on the item itself.
The item starts at row line 2 and column line 1, then ends at row line 4 and column line 3. It spans two rows and two columns in that region.
Yes. You can use span syntax such as grid-area: 1 / 1 / span 2 / span 3 to stretch an item across multiple rows and columns from a starting line.