개발노트/CSS
Grid
전지적민자시점
2020. 9. 16. 07:54
Flexible grids with the fr unit
using lengths and percentages, we can use th fr
unit to flexibly size grid rows and columns.
change your track listing to the following definition, creating three lfr
trak
.container{
display : grid;
grid-template-columns : 1fr , 1fr, 1fr;
}
the fr
unit distributes space in proportion, therefore you can give different positive values to tracks
.container{
display : grid;
grid-template-columns : 2fr , 1fr, 1fr;
}
2fr
of the available space and the other two tracks get 1fr
making the first track larger.
Gaps between tracks
the properties grid-column-gap
for gaps between columns, grid-row-gap
for gaps between rows, and grid-gap
to set bot at once
.container{
display : grid;
grid-template-columns : 2fr , 1fr, 1fr;
grid-gap:20px;}
728x90