开发者

CSS line-height question

What is the ideal line-height an开发者_开发百科d what type of value should I use with line-height values, em, px or percentages?


em is relative and will scale nicely when/if your users change the text size (which my mom, for example, often does for readability reasons).


It is usually considered for a comfortable reading experience that line height should be 1.5 to 2 times the size of the font.

p{
font: normal 10pt/15pt sans-serif;
}

Note that it depends on the font you use. In web design, every rule has to be taken with a grain of salt.


A lot of people tend to use 1.2-1.5 em as this is relative to your font size and had a nice 'look' to it. I am sure a typographer could explain more fully where those values come from.


As Alex points out, you should use em, percent or whole numbers for line-height so it scales well. See line-height on the Mozilla Developer's Network reference for further explanation.

p{
 font: normal 10pt/1.5 sans-serif;
}


The ideal line-height is 1.3.

Note that I didn't use a unit for that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜