user1791841
user1791841

Reputation: 133

Why aren't my inline-block divs aligning properly?

#inlineBLock1, #inlineBLock2{
    display:inline-block;
    width:200px;
    height:100px;
    border: 1px dashed #cccccc;
}

<div id="inlineBLock1">
    <img src="http://www.emec.org.uk/wp-content/uploads/2013/10/Aquamarine-Powers-Oyster-800-wave-energy-machine-in-operation-Image-Aquamarine-Power-300x199.jpg" width="50" height="50">
</div>
<div id="inlineBLock2">
    <p>Not aligned :(</p>
</div>

See http://jsfiddle.net/6FGHd/13/ for example.

It seems that inserting an image into one of the divs breaks the alignment.

Any ideas? Thanks.

Upvotes: 0

Views: 524

Answers (1)

drip
drip

Reputation: 12943

Your answer is in your question.

Why aren't my inline-block divs aligning properly?

You apply:

vertical-align: top;

Demo :)

Upvotes: 2

Related Questions