Reputation: 1127
I have a inline-block element and some text on the same line. They don't seem to align on the same baseline.
<div>
<i class="avatar"></i>
<span>Name</span>
</div>
i.avatar {
display: inline-block;
width: 50px;
height: 50px;
box-sizing: content-box;
border: 2px solid black;
}
span {
display: inline-block;
border: 2px solid black;
}
Please see http://jsfiddle.net/Cr952/ for what I mean.
Any ideas to align them? Thanks.
Upvotes: 0
Views: 145
Reputation: 721
Is this what you want?
then use float:left
as follow,
CSS
i.avatar {
display: inline-block;
width: 50px;
height: 50px;
border: 2px solid black;
float: left;
}
span {
display: inline-block;
border: 2px solid black;
float: left;
}
Upvotes: 0
Reputation: 10618
Add vertical-align: bottom
to i.avatar
.
i.avatar {
display: inline-block;
width: 50px;
height: 50px;
box-sizing: content-box;
border: 2px solid black;
vertical-align: bottom;
}
Upvotes: 2