html css fr code example
Example: css fr
/*
the fr unit is used in css grid layouts
that translates to "one fraction of the grid"
for example
*/
.grid
{
display: grid;
grid-template-columns: 25% 25% 25% 25%;
}
/*
Here I want to have 4 rows that are a quarter of the grid each,
to avoid overflow. But what if I happen to add a fifth row? I'd have
to manually set each part to 20%, and that might be uncomfortable. So
a better approach for this would be to use fr
*/
.grid
{
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
/*
Here if I add another column, the other ones will be automatically resize to
make it fit
I hope I could help you :)
*/