offline version v3


205 of 298 menu

grid-area property

The grid-area property specifies an element name in a grid. These names are specified in the grid-template-areas property, which lists the element names in the order in which they need to be placed in the grid.

Syntax

selector { grid-area: element name; }

Example

Let's name and position our elements in the grid:

<div id="parent"> <div id="elem1">1</div> <div id="elem2">2</div> <div id="elem3">3</div> </div> #elem1 { grid-area: first; } #elem2 { grid-area: second; } #elem3 { grid-area: third; } #parent { display: grid; grid-template-areas: 'third second first'; border: 2px solid #696989; padding: 10px; } #parent > div { padding: 10px; border: 1px solid #696989; }

:

See also

enru