Design comparison
Solution retrospective
Which is better, using explicit grid container width with repeat(3, 1fr)
or using repeat(3, 20rem)
? Or both of these is not good?
Any comments are welcomed!
Community feedback
- @adityaphasuPosted about 1 year ago
Hello @devusexu!
To answer your question, using
repeat(3, 1fr)
or using repeat(3, 20rem) is actually okay.- Use
1fr
for situations where you want columns to adapt proportionally to the available space, creating a flexible design. - When you need precise control over column sizes you can use explicit grid values like
repeat(3, 20rem)
. (people actually do this a lot)
So it's quite alright to use
repeat(3, 20rem)
and in this solution since you are using flex to center all the stuff using it works rather thanfr
since fr depends upon the available space and being in the center due to body flex the grid doesn't have much space to allocate to the grid items hence they get squished as 1 fr tries to equally make 3 columns with the little space it has.By the way nice solution! Good semantics and good design!
Keep up the good work and happy coding!ππ»
Marked as helpful2@devusexuPosted about 1 year agoHello @adityaphasu, it's pleasant to have you again!
Thanks for your clear explanation, encouragement and letting me know that people do actually use this practiceπͺ
Keep up the good work and happy coding to you too π
1 - Use
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord