1

When I started finding my way in webdesign I always used 'px' units to define everything from marges, paddings, font-sizes etc. Then I switched over to relative units. Using EM and REM.

I understand the concept of using EM's or REM's for typography. Especially for responsive websites it comes in handy. But I don't get why I should use them for other elements than typography (for instance margins and paddings). Because when we set the font-size larger for small screens the margins and paddings will also increase, which is impractical for mobile devices and I don't want that.

So should we only use relative CSS units for typography? Or am I misunderstanding the dynamics of these relative units and using them wrong?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Jabba Da Hoot
  • 794
  • 2
  • 7
  • 16
  • 1
    I agree; see more detail here. http://stackoverflow.com/questions/2915508/is-it-bad-to-work-with-pixels-in-css/2916269#2916269 – Alex Feinman Dec 31 '15 at 16:16

1 Answers1

1

I would use relative measurements for vertical paddings and margins but fixed for horizontal. That way vertical rhythm is kept when font-sizes are changes by the users' device, but doesn't squash everything up horizontally.