Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

QR Code with CSS Grid

@CITRG

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


When should you use em over rem? Are there any better practices that I could incorporate into my CSS?

Community feedback

@orphandeity

Posted

I would suggest using 'rem' units for most things, since the sizing is based on the root font-size and it will give consistent & predictable results.

However, in certain situations, it could be helpful to have the sizing based on the font-size of a particular element. For instance - if you have set the font-size on a button to something other than 1rem, using 'em' units to set the border-radius will give you better control.

I hope that made sense... if not, or if you want more color, here's a good article

Marked as helpful

0

@Meobot

Posted

Honestly, your CSS looks great to me, as a bit of a novice, mind you. I did want to answer your question though. To keep it short, em is used for things you want to scale to the font-size of the parent element, and rem is when those elements don't need to care about the parent font-size.

Excellent job by the way!

Marked as helpful

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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