grid-area property controls code example

Example 1: css grid-area names

.grid {
  display: grid;
  grid-gap: 20px;
  grid-template-rows: [header-start] 20vh [header-end] ;
  grid-template-columns: [sidebar-start] 1fr 2fr [sidebar-end] 1fr 2fr 1fr 2fr;
}

.header {
  grid-row: header-start;
  grid-column: 1 / -1;
}

.sidebar {
  grid-row: 2;
  grid-column: sidebar-start / sidebar-end;
}

Example 2: grid-area

.item {
  grid-area: <name> | <row-start> / <column-start> / <row-end> / <column-end>;
}

Tags:

Misc Example