tags:

views:

68

answers:

3

in my projects i use em for sizing of font only with body {62.5%}?

with this method i can easily calculate em value.

so what are pros and cons if i use em sizing unit for width, height, padding, margin, line-height, even for inline images also along with font for fixed width layouts?

A: 

The biggest downside is in indentation and text-block alignment with fonts of different sizes with em-sizing. It gets hard to line things up exactly – if that's important to you (and it should be).

Robusto
I need pixel perfect design as much as possible. So 'em' for font only and 'px' for other thing , should stick with same?
metal-gear-solid
If I understand you correctly, yes.
Robusto
A: 

Well if you understand how em work you can do just about anything you can do with pixels for example but with a bit more calculation.

Actually you could do more, for example, if you have a h1 header you could specify line-height and bottom margin in em's to they always reflect the font size of that header. As you increase a font size of header you increase the margins and line-height too.

This can be used to create a dynamic vertical rhythm for example.

Also if you build a complete web site in relative units you can achieve zoom effect in older browser, etc.

But with modern browsers and if you can afford to not to support behemonts like IE6 you can use absolute units and still get a full page zoom.

rebus
A: 

Em-sizing is useful for liquid layouts, but less so for fixed layouts. Not to say that it is useless, but a fixed layout is easier to set up using pixels. You can of course continue using ems for font sizing.

Grant Palin