Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #37501
    Andy Howells
    Participant

    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.

    #100631
    TheDoc
    Moderator

    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.

    #100636
    Senff
    Participant

    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.

    #100637

    I’ve written an article on how I set up my baseline: http://joshnh.com/2011/08/how-to-set-up-a-baseline-grid/

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

    #100645

    @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)
  • The forum ‘CSS’ is closed to new topics and replies.