🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #183

Grid Item Named


Naming Grid Items with grid-area

The CSS grid-template-areas is a grid container property, and it specifies areas within the grid layout.

You can name grid items by using the CSS grid-area property, and then reference to the name in the grid-template-areas property.

Each area is defined within apostrophes. The named grid items in each area is defined inside the apostrophes, separated by a space.

Example

  .container {
  display: grid;
  grid-template-areas: 'myHeader
  myHeader myHeader myHeader myHeader';
}

.item1 {
  grid-area:
  myHeader;
}

We can use a period sign (.) to refer to a grid item with no name:

Example

  .container {
  display: grid;
  grid-template-areas: 'myHeader
  myHeader myHeader . .';
}

.item1 {
  grid-area:
  myHeader;
}

To define two rows (two areas), define the second row inside another set of apostrophes:

Example

  .container {
  display: grid;
  grid-template-areas:
    'myHeader
  myHeader
  . . .'
    'myHeader myHeader . . .';
}

.item1 {
  grid-area:
  myHeader;
}

Make a ready-to-use Webpage Template

Here, we will name all grid items to make a ready-to-use webpage template:

Example

  .item1 { grid-area: header; }
.item2 { grid-area: menu; }
.item3 {
  grid-area: main; }
.item4 { grid-area: right; }
.item5 { grid-area:
  footer; }

.container {
  display: grid;
  grid-template-areas:

  'header header header header header header'
    'menu main
  main main main right'
    'menu footer footer footer footer
  footer';
}

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Grid Item Named – FAQs

Quick answers about learning Grid Item Named in CSS.

This free note from CodingNow 2.0 explains Grid Item Named in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Grid Item Named, is 100% free with no signup required.
With focused practice, most students grasp Grid Item Named in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now