Accessibility

CSS Advisor

Half line-height bug

by CSSAdvisorAdmin on October 31, 2006
Edited by: Amy C Taylor on November 24, 2009
Avg Rating 2.0 (2)   |   Log in to rate post.

Tagged with Explorer 6.0 , Explorer 5.0 , Position , Explorer 5.5 , Width/Height

Problem

If line-height is defined for a block, it will collapse by half for any line that contains a replaced element (img, input, textarea, select, or object).

Solution

Alas, there is no reliable fix for this bug. Taking the element in question out of normal page flow (by either absolute positioning or floating it) will fix the bug, but not exactly solve the problem.

Detailed description

This bug will be triggered by the presence of any replaced element, images, form elements and object tags alike. It's also impossible to fix, but instead can be worked around.

What's happening? Well, the CSS 2.1 recommendations (reference) specify that the difference between line-height and font-size is leading- half of that value is half-leading. Browsers and other user agents should apply half-leading to the top and bottom of inline elements accordingly. However, Internet Explorer (versions 6 and earlier) instead collapses the half-leading of the current line with the half-leading of the preceding and subsequent lines if the line contains a replaced element.

This bug was originally reported by Jeroen Mulder on positioniseverything.net.
You can review Jeroen's original article here.




Text ID: HALF_LINE_HEIGHT



Comments (1)

To add a comment, please Log in.




Table solution?

I inserted a table and put the offending element, in this case an image, in a separate cell from the standard text.  I no longer have the half_line_height error from Dream_Weaver, but does that mean it will really work?  or is the bug fixed by now?





CSS Advisor home
Submit a post

rss

CSS ADVISOR RSS FEEDS
Recent: POSTS | COMMENTS | EDITS


Browsers
Internet Explorer (45)
Mozilla/Firefox (16)
Opera (7)
Safari (13)
CSS Properties
Background (6)
Border (3)
Color (1)
Float (15)
Font (1)
Margin (6)
Padding (4)
Position (15)
Text (13)
Width/Height (9)