Give help. Get help.

  • # April 4, 2012 at 6:21 pm

    I’ve been in the habit of declaring a 62.5% font-size in the body for quite a while and then using EM’s throughout my CSS. It makes it super easy as 1em is then 10px and so forth.

    I was thinking about it earlier today but this is probably wrong isn’t it? I use a standard CSS reset beforehand but I’m thinking there’s got to be a better way of going about it and I’m not sure of potential ramifications.

    # April 4, 2012 at 6:50 pm

    I remember this being pretty much an industry standard, though I have moved away from ems since. I don’t think you’re wrong in using it.

    # April 4, 2012 at 8:51 pm

    I don’t think it’s wrong as such, and I’ve done it myself as well for a long time. However, I started to run into problems when I gave a font size of, say, 1.2em to a div (so all text would be 12px), and then I had a specific child div in there that needed to be 10px. In that case, I couldn’t apply 1em, because that would be 100% of its container font = 12px anyway.

    I mean, it wasn’t an issue to set the text to 10px, it was just messing up the rule “1em = 10px”. Or rather, it because “1em = 10px but only if any parent doesn’t have a font size setting“, and so I didn’t see much advantage to that anymore.

    I always thought em’s were handy since they were relative to their container font size — change it somewhere and all it’s children would change with it. I just never really found actual use for it.

    # April 4, 2012 at 8:56 pm

    I’ve written an article on how I set up my baseline:

    But it’s probably easier these days to just use rems with pixels as a fallback.

    # April 5, 2012 at 4:12 am

    @treq I think you missed my point completely. Ems are way harder to work out than rems, so you would generally do one or the other. Not both.

    If you want full browser support, use ems. If you want to use rems, but also want it to work in older browsers, use a fallback (pixels, as no point using rems currently if you are using ems).

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.