Nearby lessons

7 of 15

🧩 CSS Grid Item

šŸ“Œ What are CSS Grid Items?

A grid item is a direct child of a grid container. šŸ“¦ It can be precisely placed and aligned within the grid using powerful properties.

These properties help control the item's position, span, and alignment within grid cells:

šŸ”§ Key Capabilities

  • šŸ“Œ Position items using grid-column and grid-row
  • šŸŽÆ Align items with justify-self and align-self
  • šŸ“ Use place-self as a shorthand

šŸŽØ Overview

Let's explore each property with examples to understand how grid items behave and align themselves inside a grid layout. šŸŽØšŸš€

šŸ”ø grid-column / grid-row

AttributeValueDescription
grid-column1 / 3Span from column line 1 to 3
grid-row2 / 4Span from row line 2 to 4
grid-columnspan 2Span across 2 columns
grid-rowspan 3Span across 3 rows

šŸ“ grid-column: 1 / 3

Spans item from column line 1 to 3.
Code Example
PREVIEW READY
Loading Editor...
Live Preview
Keep Going!CSS - Animations