CSS Grid Layout
CSS Grid Layout is a powerful two-dimensional layout system that allows you to create complex web layouts with ease.
To create a grid container, use:
.container {
ㅤdisplay: grid;
}
Use grid-template-columns and grid-template-rows to define the structure:
.container {
ㅤdisplay: grid;
ㅤgrid-template-columns: 1fr 1fr 1fr;
ㅤgrid-template-rows: 100px auto;
}
To add space between grid items:
.container {
ㅤgap: 20px;
}
Use grid-column and grid-row to place items:
.item {
ㅤgrid-column: 1 / 3;
ㅤgrid-row: 1 / 2;
}
CSS Grid Layout provides a robust system for creating complex web layouts. It offers precise control over the placement and sizing of elements, making it an essential tool for modern web design.