Reputation: 659
I worked at a template and i tried to use display: inline-block;
to arange the divs on page and i observed a behaviour that i couldn't explain. The div's with display: inline-block;
containing some element like : span
, div
or a
are displayed below than without something inside.
I looked with Firebug but there is not a margin or padding arround that could explain the spacing.
This behaviour is fix only if i display the span
, div
or a
as :
table-cell
// Chrome Firefox IE9table-row
// Chrome Firefox IE9flex
// Only Firefox table
// Chrome Firefox IE9Can someone provide more details or some advice aboud this behaviour.
Upvotes: 0
Views: 491
Reputation: 18093
Add vertical-align: top
to your div
s like so:
div {
vertical-align: top;
}
Demo in a fiddle: http://jsfiddle.net/85StK/5/
This homogenizes the vertical alignment of the div's making a them all display inline .
Upvotes: 4