CSS Tutorial



CSS GRID


CSS Grid Layout

CSS Grid Layout is a two-dimensional layout system for the web, allowing you to design web pages using rows and columns. It’s powerful and flexible, making it easy to create complex layouts.

πŸ“ Syntax:

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

πŸ§ͺ Live Example:

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6

πŸ”§ Common Properties:

  • display: grid; β†’ enables grid layout on the container
  • grid-template-columns: β†’ defines the number and size of columns
  • grid-template-rows: β†’ defines the number and size of rows
  • grid-gap: β†’ sets the gap between rows and columns
  • grid-column: β†’ defines the position of an item in the grid
  • grid-row: β†’ defines the position of an item in the grid vertically

πŸ“± Responsive Layout Tip:

Use grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); to create a responsive grid layout that adjusts the number of columns based on available space.


🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review