2

I'm struggling to figure out how it's a benefit to use REM's with a pixel fallback. The app that I'm working on has REM's declared as approximately 10px's by setting the font-size on the html as such;

html {
  font-size: 62.5%; /* Sets up the Base 10 stuff */
} 

Than in my CSS file I would assign font-sizes like this.

.myClass { 
    font-size: 18px;
    font-size: 1.8rem;
}

Obviously the pixel definition is there as a fallback if there is no support for CSS rem's. The question is, what is the point of even using REM's if they equate to the same size as pixels, why not just use pixels instead?

Chris Hawkes
  • 11,923
  • 6
  • 58
  • 68

1 Answers1

5

font-size: 62.5%; only sets the font size to 10px on the html element if the browser is set to factory defaults.

If the user has selected a different default font size, then everything will be scaled to match.

Firefox font size preferences

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thank you. It makes perfect sense now, I changed my font-size in chrome and everything scaled well. When I viewed the site in question I noticed things were out of place, those things were because certain pieces did not have the rem's for width, height etc... so they did not scale well with everything else that did. – Chris Hawkes Apr 20 '15 at 19:20