grid & inline-grid
The container is defined with display: grid or display: inline-grid, and its direct children become grid items that are distributed within the grid.
- grid: The container behaves as a block that takes up all the available width.
- inline-grid: The container behaves as an inline element, occupying only the necessary space.
Example
In this dynamic example, we can see how the child elements adjust depending on the value of display.
ResultLive
html
css