Design comparison
Solution retrospective
I was able to implement the BEM CSS styling method which I have never used before. Hope I implemented it the right way!
What challenges did you encounter, and how did you overcome them?Probably trying to figure out the rem
values for the various px
values used in the project.
- How was my implementation of BEM? Is that's how it's done or is there a better way I missed?
- Is using
rem
for the various sizes including thetext-size
,width
, andborder-radius
the best way to scale the elements based on the screen size? Did I use therem
sizing the correct way?
Community feedback
- @AlyferJTPosted 3 months ago
Well, the view code page is going to 404, you changed the project name. But, congratulations!
The thing about rem is
root-em
, he is a size unit based on the root value, since the default root value is 16px in most cases.5rem = 8px 1rem = 16px 2rem = 32px 5rem = 80px And so on and so forth...
but there is a trick that a lot of users use The 62.5% Font Size Trick I recommend you to search about it
This trick is about setting the root default size to 62.5%. It's 62.5% of the default (16px) that is equal to 10px. They set then inside the
html {}
, like this:html { font-size: 62.5%; }
That's how you set it Well, this bring us a lot of benefits, and i personally like to use it This helps us setting responsive fonts on the screen, since not all browsers uses the same font-size by default, and some users grow up the font to better see then, you could say that it brings us a help with the accessibility, actually this is a rem property, but you simplify the use with this 62.5% trick
Anyway, when you set the 62.5%, this is the way you would use the rem:
.5rem = 5px 1rem = 10px 2rem = 20px 5rem = 50px And so on and so forth...
Cool, right? You can clearly see how much px the rem will give That's a life savier Well, that's not all, this is the main idea about the trick But i recommend you to search about it, there is a lot about
Marked as helpful1@skipperr254Posted 3 months ago@AlyferJT Hi there Alyfer, thanks for the insights.
I didn't notice with the GitHub code page link being broken. I also saw the 62.5% trick somewhere but I never went in too deep with it. It's a good idea and will definitely implement it in a future project. There is a downside, however, you have to implicitly define the font-size of almost all your elements. Not found a way to by-pass that yet.
Thanks for the idea and your feedback.
1@AlyferJTPosted 3 months agoNp. :D
rem
has the responsive benefits and setting all the font-sizes is not a bad thing in my vision. But maybe you think in some size unit you would like to use, likeem
, that is relative to the font size of its parent, so, maybe you could useem
0
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