Design comparison
Solution retrospective
One more solution, I really liked the final result, this background made the design very beautiful.
In this challenge, I was wondering, is it a good idea to use "rem" for margins?
I feel that using "em" makes it more difficult to calculate.
As always I would like to thank you for your attention in seeing my solution. 😉✌😊
Community feedback
- @subu-vPosted over 2 years ago
It is a good idea to use rem unit for margins as well as for so many things.
rem units is based on root element which is html. By default 1rem = 16px.
To make calculation easy when using rem, make the font-size in html element to 10px which should be done in percentages so that it scales up and down according to the user browser font-size.
10px/16px = 0.625 * 100 = 62.5%.
html{ font-size : 62.5%; }
Why you should do it this way?
- Let's if the user want's to increase the font-size in his/her browser, by default it is 16px, now if the user set to 20px, now the font-size in the html element will scale up accordingly, now the font-size will be 62.5% / 100 * 20px = 12.5px
**Now for all things you set using rem unit in your project(eg margins,paddings etc) will change from 10px to 12.5px. **
- Another reason to do this, calculating rem units based on 16px is difficult compared to 10px which can be done easily.
I hope you understand.
Marked as helpful1
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