Introduction of Grid in CSS

Introduction of Grid in CSS

Grid:-

The grid CSS property is a shorthand property that sets all of the explicit and implicit grid properties in a single declaration.

Using grid you specify one axis using grid-template-rows or grid-template-columns, you then specify how content should auto-repeat in the other axis using the implicit grid properties: grid-auto-rows, grid-auto-columns, and grid-auto-flow.

Values:-

<'grid-template'> Defines the grid-template including grid-template-columns, grid-template-rows and grid-template-areas.

<'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? Sets up an auto-flow by setting the row tracks explicitly via the grid-template-rows property (and the grid-template-columns property to none) and specifying how to auto-repeat the column tracks via grid-auto-columns (and setting grid-auto-rows to auto). grid-auto-flow is also set to column accordingly, with dense if it's specified. All other grid sub-properties are reset to their initial values.

Syntax:

image.png

Example:

image.png

image.png