cristinafsanz
8/20/2019 - 3:32 PM

What unit to use

By Scrimba: https://scrimba.com/c/c7za7McV

My general rule of thumb:

  • font-sizes = rem
  • padding and margin = em
  • widths = px or em or %

For width, percentage is very common, whereas either pixels or em work well for set sizes, like when setting a min-width or max-width. If you stick with pixels here, you'll be fine :)

REM vs EM: https://zellwk.com/blog/rem-vs-em/

  • Size in em if the property scales according to its font-size
  • Size everything else in rem.