Open In App

What is CSS Grid Layout ?

Last Updated : 31 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The CSS Grid Layout is a powerful two-dimensional layout system that allows you to design complex web layouts with rows and columns. It provides a more flexible and efficient way to create grid-based designs compared to traditional methods.

Note: An HTML element becomes a grid if that element sets display: grid; in style section or inline-grid.

Syntax

.class {
display:grid;
}

Features

  • Two-Dimensional Layout: CSS Grid allows you to define both rows and columns, creating a grid structure.
  • Responsive Design: Makes it easy to create responsive layouts by defining flexible units like fr (fractional unit) and using media queries.
  • Alignment and Spacing: Provides properties for precise alignment (justify-items, align-items) and control over spacing between grid items (gap).
  • Grid Areas: You can name grid areas and place items into specific named areas.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads