![]() |
VOOZH | about |
The CSS Grid Layout module is used to create a grid-based layout system. Which uses rows and columns, it simplifies the design of webpages without relying on floats and positioning of the elements.
Syntax:
.class {
display:grid;
}
Note: An HTML element becomes a grid if that element sets display:grid
Represents a repeated fragment of the tracklist, allowing a large number of columns that exhibit a recurring pattern to be written in a more compact form. It allows you to define a pattern repeated X times.
Indicates auto-placement, an automatic span, or a default span of one Column is fitted to the content in the column. The row is fitted to the content in the row.
The fr unit is a fractional unit, an input that automatically calculates layout divisions when adjusting for gaps inside the grid.
Here are some examples:
This example demonstrates the use of the fr unit in CSS Grid, where each grid column takes up an equal fraction of the available space.
In this example, we define a grid with columns that use different fractional units, allowing certain columns to take up more space. The first two columns each take up 1fr (one fraction of the available space), while the next two columns take up 2fr each, which gives them twice as much space as the first two columns.
In this example, the repeat() function is used to create multiple columns of equal size, while auto ensures that the row height adjusts automatically based on the content. This combination is useful when you want a dynamic and responsive grid layout.