CSS Grid

CSS Grid is a powerful layout system that allows web developers to create complex and flexible grid-based layouts for their web pages. Here are all the CSS Grid properties along with examples of their usage:
display: grid;- defines an element as a grid container.
cssCopy code.container {
display: grid;
}
grid-template-columns- defines the columns of the grid.
cssCopy code.container {
grid-template-columns: 1fr 2fr 1fr;
}
grid-template-rows- defines the rows of the grid.
cssCopy code.container {
grid-template-rows: 100px 200px;
}
grid-template-areas- defines named grid areas.
cssCopy code.container {
grid-template-areas:
"header header header"
"sidebar content content"
"footer footer footer";
}
grid-template- shorthand for defining the columns, rows, and areas of the grid.
cssCopy code.container {
grid-template:
"header header header"
"sidebar content content"
"footer footer footer" / 1fr 2fr 1fr;
}
grid-column-gap- defines the space between columns.
cssCopy code.container {
grid-column-gap: 20px;
}
grid-row-gap- defines the space between rows.
cssCopy code.container {
grid-row-gap: 10px;
}
grid-gap- shorthand for defining both column and row gaps.
cssCopy code.container {
grid-gap: 20px 10px;
}
justify-items- aligns items horizontally within their grid cell.
cssCopy code.container {
justify-items: center;
}
align-items- aligns items vertically within their grid cell.
cssCopy code.container {
align-items: center;
}
place-items- shorthand for aligning both horizontally and vertically.
cssCopy code.container {
place-items: center;
}
justify-content- aligns the grid along the horizontal axis.
cssCopy code.container {
justify-content: center;
}
align-content- aligns the grid along the vertical axis.
cssCopy code.container {
align-content: center;
}
place-content- shorthand for aligning both horizontally and vertically.
cssCopy code.container {
place-content: center;
}
justify-self- aligns an item horizontally within its grid cell.
cssCopy code.item {
justify-self: center;
}
align-self- aligns an item vertically within its grid cell.
cssCopy code.item {
align-self: center;
}
grid-auto-columns- defines the size of columns created implicitly.
cssCopy code.container {
grid-auto-columns: 100px;
}
grid-auto-rows- defines the size of rows created implicitly.
cssCopy code.container {
grid-auto-rows: 100px;
}
grid-auto-flow- controls the placement of items that are not explicitly placed.
cssCopy code.container {
grid-auto-flow: dense;
}
grid- shorthand for defining all grid properties.
cssCopy code.container {
grid:
"header header header"
"sidebar content content"
"footer footer footer" / 1fr 2fr 1fr;
grid-gap: 20px;
justify-items: center;
align-items: center;
justify-content: center


