Starlit Daily

📚 › CSS: style and layout

12. Grid: rows and columns

इस लेख का अनुवाद अपने आप होगा। अभी अंग्रेज़ी में दिखाया जा रहा है।

display: grid makes a two-dimensional layout. grid-template-columns sets the columns; repeat(3, 1fr) makes three equal columns. The gap property spaces the cells.

Use grid for page layouts and galleries, and flexbox for rows of items.

उदाहरण देखें

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

✍️ अब आपकी बारी

Make .gallery a grid with four equal columns and a gap of 8px.

← कोर्स पर वापस