Design comparison
Solution retrospective
Hello everyone, I've finished the challenge and I think that everything works perfectly.
If you have any tips about how to optimize the code do not hesitate to tell me !
Have a great day
Community feedback
- @JakubKepakPosted over 3 years ago
Hi Louis, very nice work! 👌👏
In your code, you use
px
for size. I would maybe use some relative measure likerem
orem
. Also, I would fill inalt
attributes for accessibility as the report suggests.Anyway, I really like your solution. Keep it up! 🙌
0@LouisterrynPosted over 3 years agoHello @JakubKepak , thank you very much ! I've heard about rem. I think I need to do html{font-size:62.5%} first so it's easier to use right ?
But what is better in using rem ?
0@JakubKepakPosted over 3 years ago@Louisterryn default font size in many browsers is 16px. By setting
html{font-size:62.5%}
you say that it will be approx. 10px so it will be easier for you to calculaterem
in your code.1 rem
= default size, in your case it10px
,2rem
= 20 px etc. If you have set it up like that, you can just easily set yourhtml{font-size:50.0%}
in your media query for instance and everything will be smaller but ratio stay the same.0@LouisterrynPosted over 3 years ago@JakubKepak Oh ok I understand why it's nice now ! Thank you very much I'll use it on next projects :D
Have a great evening sir
0@JakubKepakPosted over 3 years ago@Louisterryn You too! also found a quite good article about rem and em https://www.sitepoint.com/understanding-and-using-rem-units-in-css/
0@grace-snowPosted over 3 years agoGlad you got this sorted, it looks pretty good ☺
On the rem size thing, yes definitely use them, but (beware, minor rant coming, haha) I always advise against changing your root (html) font size to 62.5%.
That can lead to unintended consequences for people who need to zoom to see your site properly. All it takes is one default element that doesn't inherit font size from its parent - if you forget to bump the font size back up on that one element using your new rem calculation, you've broken the site for all those people.
We don't need to 'work with rems' or make manual calculations with them so there's no need to change the value from 100% on html IMO (usually equates to 16px).
I've yet to see a site that needed everything to be in divisible units of 10 in all my years, so there's really no need.
I have see it where base font size is bumped up to 112.5% (18px) but even that is only in certain circumstances, and much less likely to negatively impact the visually impaired.
So... My take is that the cons outweigh the pros on this one!
1@JakubKepakPosted over 3 years ago@grace-snow Didn't think about this like that. Thank you for the comment.
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