Previous Message
Next Message

is use of rem bad?

Sent by Tom Livingston on 20 July 2016 18:06

On Wed, Jul 20, 2016 at 1:05 PM, John J [EMAIL-REMOVED]> wrote:

> Working on my code, I decided to see what they CSS validator had to say
> about it, and it threw out 154 errors, most of which were about rem as my
> value of measure for things like padding, type, borders, margin.
> I am using rem on advice of a developer who said that a certain pinhead,
> un-named browser needs it; other browsers can use/deal with it too.
> Yet the validator threw a hissy..Should I abandon all efforts to support
> arcane versions of this browser, and stick only with em?
> Thank you!
> John

While I haven't used rem for padding or margin myself (as far as I can
remember), I usually use rem on all new projects going forward. I do
provide a fallback of px, however, for support of those browsers who need
it (though I may stop doing that as well soon). I use Sass (.scss) and have
a nice mixin for this:

@mixin font-size($size) {
font-size: ($size / 16px) * 1rem;

and in my scss file, I use it like this:

@include font-size(13px);

which compiles to this:

font-size: 13px;
font-size: .813rem;

The validator isn't always right for html5. I'd have to see the error and
evaluate it.



Tom Livingston | Senior Front End Developer | Media Logic |
ph: 518.456.3015x231 | fx: 518.456.4279 |

css-discuss [EMAIL-REMOVED]]
List wiki/FAQ --
List policies --
Supported by --
Previous Message
Next Message

Possibly related: