Design comparison
Solution retrospective
when I tried to use rem units the whole design was scaled up I don't know the reason yet, I set the font size on the body to 62.5% so that 1rem = 10 px and changed all the px units to rem. but it didn't work as i expected
Community feedback
- @vanzasetiaPosted over 2 years ago
Hi, Mohamed Samir! 👋
Congratulations on finishing this challenge! 👏
Regarding your question, first changing the
body
font size doesn't effect how much1rem
inpx
. You need to change thehtml
element instead. But, I don't recommend changing thehtml
or the:root
font size. It can cause huge accessibility implications for those users with different font sizes or zoom requirements. I suggest reading this article by Josh Comeau where he tells about the problem of the 62.5% trick (and more!). Also, I recommend reading what an accessibility expert (Grace Snow) has said about it.Some suggestions.
- I would recommend moving all the CSS code into a separate file. It's best to separate the HTML and CSS on its own file so that it is easier to maintain and read as well.
- It is possible to make the site responsive without any media queries. For the card element (or in this case the
.container
element) to be responsive, all it needs is amax-width
(nowidth
). By doing this, it allows the card to shrink if needed and grow until it hits themax-width
. - For the
img
element, I recommend styling it as the following. This will make it easier to work withimg
element. By default, theimg
element is an inline element which is hard to manipulate.
img { display: block; max-width: 100%; height: auto; }
That's it! Hope you find this useful! 😁
Marked as helpful1@mohamed-sameerPosted over 2 years ago@vanzasetia thank you so much for the feedback I appreciate it. the sources you provided were indeed helpful.
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