Grid - Area Property

The grid-area property specifies a grid item's size and location in a grid layout, and is a shorthand property for the following properties:

  • grid-row-start

  • grid-column-start

  • grid-row-end

  • grid-column-end

Value

Description

grid-row-start

Specifies on which row to start displaying the item.

grid-column-start

Specifies on which column to start displaying the item.

grid-row-end

Specifies on which row-line to stop displaying the item, or how many rows to span.

grid-column-end

Specifies on which column-line to stop displaying the item, or how many columns to span.

itemname

Specifies a name for the grid item




Code:

<!DOCTYPE html>
<html>
<head>
<style>
.grid-container {
  display: grid;
  grid-template-columns: auto auto auto auto;
  grid-gap: 10px;
  background-color: pink;
  padding: 10px;
}

.grid-container > div {
  background-color: white;
  text-align: center;
  padding: 20px 0;
  font-size: 30px;
}

.item1 {
  grid-area