When looking at the example provided, it is important to note that the first font-size
specified (16px
) will serve as a backup for browsers that do not support rem
units. On the other hand, browsers that do support rem
units will utilize the latter font-size
(1rem
) because it comes after the initial one and takes precedence.
body,
button,
input,
select,
textarea {
color: #404040;
font-family: sans-serif;
font-size: 16px; /*This acts as a fallback if rem units are unsupported */
font-size: 1rem; /*This second definition overrides the first in supported browsers due to its positioning after the initial declaration */
line-height: 1.5;
}
If you're interested in browser compatibility with REM units, check out CANIUSE for detailed information. Fortunately, support for REM units is quite widespread, with only older versions of IE posing potential issues: http://caniuse.com/rem
For further insights into REM units, I recommend reading this informative article:
http://www.sitepoint.com/understanding-and-using-rem-units-in-css/