I have a slightly modified Bootstrap Dropdown to truncate text within the button element, however, there seems to be a difference in how the height of the button element is calculated.
This fiddle demonstrates what I did initially The key seems to be the CSS controlling the span element within the button.
button.btn span {
min-width:91px;
max-width:91px;
overflow:hidden;
white-space:nowrap;
-ms-text-overflow: ellipsis;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
display:inline-block;
}
Below are the browser metrics for IE and chrome for the height of the button element:
Replacing the inline-block style on the span with a float: left as demonstrated in this fiddle appears to correct the heights and works across both browsers.
button.btn span {
min-width:91px;
max-width:91px;
overflow:hidden;
white-space:nowrap;
-ms-text-overflow: ellipsis;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
float: left;
}
What is causing the difference in element height between Chrome and IE when using inline-block and which is doing it correctly?
Update: Firefox appears to do the same thing as IE here.
Compared to display: inline , the major difference is that inline-block allows to set a width and height on the element. Also, with display: inline , top and bottom margins & paddings are not respected, and with display: inline-block they are.
The display: inline-block Value Compared to display: inline , the major difference is that display: inline-block allows to set a width and height on the element. Also, with display: inline-block , the top and bottom margins/paddings are respected, but with display: inline they are not.
Inline element properties:The height and width of an inline element cannot be set in CSS. You cannot set the height and width of block-level elements in CSS. Inline elements flow left to right, meaning inline elements appear on the same line unless the line wraps or there's an explicit line break ( <br/> )
The inline-size CSS property defines the horizontal or vertical size of an element's block, depending on its writing mode. It corresponds to either the width or the height property, depending on the value of writing-mode .
I think that you'll find your answers at this URL:
http://blog.mozilla.org/webdev/2009/02/20/cross-browser-inline-block/
Note: did you gave a try to display:table-cell
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With