Search This Blog

Sunday, May 2, 2010

CSS Line Height Property

- Typical leading set to a block of text is 50%. This means that for a font size of 12 pixels, there will be 3 pixels that are added on the top and on the bottom of each line, resulting in the line height of 18 pixels (12 pixels + (2 ∗ 3 pixels)). On the web, it's a good idea to set leading to 70% to 80%.

For example, for a line-spacing of 70% for 0.75 em font-size, line height should be:
0.75 * 1.7 = 1.275 em

- If the line height is 1.275 ems, then the space between paragraphs should be 1.275 ems as well.

- Headings can be smaller or greater than one line height (normally not greater than two line heights), but its vertical spacing should still be related to the basic leading. For example, if the heading is 24 pixels and the line height of the normal text is 18 pixels, then the line height of the heading will be 36 pixels

- Headings and subheadings can have an extra space on top equal to one half of the line height. In this case, the top margin will be equal to 3⁄2 of a line height, and the bottom margin to one line height.


body {
font-size:100%;
line-height:1.75em; /* 1 * 1.75 */
}

.bodytext p {
font-size:0.875em;
}

.sidenote {
font-size:0.75em;
}



body {
font-size:16px;
}



em calculator

No comments:

Post a Comment