Design comparison
Solution retrospective
Found this one quite easy! Started to use rem instead of px... Could that be why scaling up from mobile to browser wasnt as painful as previous?
What challenges did you encounter, and how did you overcome them?Still building on a mobile which has added complexity, no live server or device viewports, no inspect/dev tools etc.
What specific areas of your project would you like help with?Using rem/em amd vh/hw... still a little unsure what best practice is and whats the easiest way of doing it
Community feedback
- @kodan96Posted 7 months ago
hi there 👋
You should avoid hard-coded values (pixels) most of the time. When you use these values you give up responsibility (or you make it harder for yourself at least)..
Typically you will increase the
font-size
property with@media
queries. If you have hard-coded values all over your CSS, you need to modify every element'sfont-size
. On the other hand, if you userem
-s all you need to do is changing thefont-size
in your CSS:root
selector and all your elements will have a new size based on that value.I usually use
em
forpadding
andmargin
for text-based elements, since their margin usually based on theirfont-size
, and again, when you change thefont-size
in:root
these values will scale up as well without you touching them, making your job easier and your page maintainable.Hope this helps! 🙏
Good luck and happy coding!
Marked as helpful1@RyanDillon94Posted 7 months ago@kodan96 - Hi Koda!
Thank's for your advice!
I have only come across the :root selector for colour variables and basically self taught myself through trial and error... sounds like i need to do some more digging on how gain the most value out of it!
Thanks again, very useful!
1
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