If you have three identical divs positioned inline-block they are aligned perfectly. But if you put any content in any of the divs it drops down below the others. Why does it do that?
<div class="left">?</div>
<div class="center"></div>
<div class="right"></div>
div {
display:inline-block;
margin-:2px;
height:100px;
width:25px;
border:1px solid black;
}
http://jsfiddle.net/7kkC6/
better example: http://jsfiddle.net/7kkC6/9/
This is because vertical-align is by default set to baseline. You can fix your problem by setting it to top :
div {
display:inline-block;
margin-:2px;
height:100px;
width:25px;
border:1px solid black;
vertical-align: top;
}
The demo here : http://jsfiddle.net/7kkC6/4/
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