Display:inline-block And Overflow:hidden Leading To Different Vertical Alignment
The following code renders differently in different browsers (IE = FF = higher than baseline, Chrome = on baseline). Whose fault is it? Where should I file a bug report? Do you kn
Solution 1:
Yes. You need to do these:
Solution 2:
It seems Chrome is in error. The CSS 2.1 spec says
The baseline of an 'inline-block' is the baseline of its last line box in the normal flow, unless it has either no in-flow line boxes or if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge.
Since the overflow property computes to something other than 'visible' the inline-block's baseline is the bottom margin edge, which sits on the baseline of the containing line box, and therefore must raise up the contained text to allow space for the descenders of that text.
Solution 3:
Try This
<!doctype html><html><head><style>.a {
display: inline;
overflow: hidden;
color: red;
}
</style></head><body>
baseline__<divclass="a">test</div>__baseline
</body></html>
Post a Comment for "Display:inline-block And Overflow:hidden Leading To Different Vertical Alignment"