22.12.2013 Views

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Empty inline elements generate empty inline boxes, but these boxes still have<br />

margins, padding, borders and a line height, and thus influence these calculations<br />

just like elements with content.<br />

Note that if all the boxes in the line box are aligned along their bottoms, the line<br />

box will be exactly the height of the tallest box. If, however, the boxes are aligned<br />

along a common baseline, the line box top and bottom may not touch the top and<br />

bottom of the tallest box.<br />

10.8.1 Leading and half-leading<br />

Since the height of an inline box may be different from the font size of text in the<br />

box (e.g., ’line-height’ > 1em), there may be space above and below rendered<br />

glyphs. The difference between the font size and the computed value of<br />

’line-height’ is called the leading. Half the leading is called the half-leading.<br />

User agents center glyphs vertically in an inline box, adding half-leading on the<br />

top and bottom. For example, if a piece of text is ’12pt’ high and the ’line-height’<br />

value is ’14pt’, 2pts of extra space should be added: 1pt above and 1pt below the<br />

letters. (This applies to empty boxes as well, as if the empty box contained an<br />

infinitely narrow letter.)<br />

When the ’line-height’ value is less than the font size, the final inline box height<br />

will be less than the font size and the rendered glyphs will "bleed" outside the<br />

box. If such a box touches the edge of a line box, the rendered glyphs will also<br />

"bleed" into the adjacent line box.<br />

Although margins, borders, and padding of non-replaced elements do not enter<br />

into inline box height calculation (and thus the line box calculation), they are still<br />

rendered around inline boxes. This means that if the height of a line box is<br />

shorter than the outer edges [p. 82] of the boxes it contains, backgrounds and<br />

colors of padding and borders may "bleed" into adjacent line boxes. However, in<br />

this case, some user agents may use the line box to "clip" the border and<br />

padding areas (i.e., not render them).<br />

’line-height’<br />

Value: normal | | | | inherit<br />

Initial: normal<br />

Applies to: all elements<br />

Inherited: yes<br />

Percentages: refer to the font size of the element itself<br />

Media: visual<br />

If the property is set on a block-<strong>level</strong> [p. 97] element whose content is<br />

composed of inline-<strong>level</strong> [p. 98] elements, it specifies the minimal height of each<br />

generated inline box.<br />

If the property is set on an inline-<strong>level</strong> [p. 98] element, it specifies the exact<br />

height of each box generated by the element. (Except for inline replaced [p. 30]<br />

elements, where the height of the box is given by the ’height’ property.)<br />

Values for this property have the following meanings:<br />

normal<br />

Tells user agents to set the computed value [p. 70] to a "reasonable" value<br />

based on the font size of the element. The value has the same meaning as<br />

142

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!