Chris Hoffman wrote:
> On 4/8/07, Philippe Wittenbergh <[EMAIL PROTECTED]> wrote:
>
>   
>> No, the computed height of the inline element (the amount of
>> background-colour that will be applied) depends on/includes the line-
>> height.
>>     
>
> But.... If I set line-height to 16px, with font-size remaining at
> 12px, I get a gap between the lines.
>
> and re: setting font-size in pixels: I realize all the potential
> problems, and am very much an em-man myself :).
>
> Chris
>
>   
Line height is not the same as font size.  With a font size of 12 px, 
the line height will be approx. 14.4px, or 1.2 times the font size.  It 
depends on your operating system and user agent, amongst other things.  
You have to allow for the ascenders and descenders in the font, so the 
total line height is more than the font size.  Therefore, setting the 
line height to 14px is actually too small and the text will actually 
overlap a little bit.  Lastly, if you mix bold and regular weight 
elements, the computed line height will be larger to encompass the 
larger elements.  The best way to specify line height is to just specify 
a number, which acts like a scaling factor.

p {
    line-height: 1.5;
}


This will always make the line height 1.5 times the font size, even for 
child elements that might inherit other font sizes.  It evens things 
out.  I usually use 1.25 and this gives consistent results across most 
user agents and os's.

Lori
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to