Design comparison
Solution retrospective
What is the more preferred unit for sizing, rem em or px?
Community feedback
- @correlucasPosted over 2 years ago
πΎHello Iwan Haryatno, congratulations for your new solution!
Answering your question:
I liked to build my solution using PIXEL and just in the end I convert all the pixel units to
rem
using a VSCODE extension calledpixel to rem
I chooserem
over the other units because this give your site a better look and a better performance between difference screen sizes and devices, because helps to scale the fonts and elements properly and pixel doesnt works so good. I thinkrem
is the unit more used between devs and this why I choose it.Here's a good source to undestand all CSS units:
https://www.w3schools.com/cssref/css_units.asp
π I hope this helps you and happy coding!
1 - @DavidMorgadePosted over 2 years ago
Hello Iwan, congrats on finishing the challenge, good job!
To answer your question, using relative units (rem, em...) for sizes, is better than using absolut units like pixels, in some cases it is better to use pixels, for example, I prefer to use Pixels to define my media queries over rems.
You can also set your rems to be equivalent to 10px instead of the default 16px using this little snippet in your CSS, then you can use rems instead of pixels in a more accurate way:
html { /* 1rem = 10px */ font-size: 62.5%; } body { font-size: 1.6rem; }
Hope my feedback helps you!
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