What's the difference between line-height:1.5 and line-height:150% in css? -


anyone knows it?

short version: line-height: 150% static, line-height: 1.5 dynamic. effect more evident on inheriting elements. example:

html

<div style="font-size: 12px">     <span style="font-size: 24px">test</span> </div> 

this css

div { line-height: 150%; } /* computed line-height: 18px (150% * 12px) */ span { }                   /* computed line-height: 18px (inherited directly) */ 

as opposed this:

div { line-height: 1.5 }   /* computed line-height: 18px (1.5 * 12px) */ span { }                   /* computed line-height: 36px (1.5 * 24px) */ 

you may read more @ css2 specs page


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -