I have the following structure:
div {
display: table;
}
img {
display: table-cell;
}
span {
display: table-cell;
vertical-align: middle;
}
<div>
<img src="http://placehold.it/200x100" /> <span>Test</span>
</div>
It seems to work but I want to know if there is an alternative without using table. If I don't use table and just use:
span {vertical-align: middle;}
It doesn't work!
I appreciate any help.
Vertically align the image and the span.
HTML
<div>
<img src="http://placehold.it/200x100" /> <span>Test</span>
</div>
CSS
img,
span {
vertical-align:middle;
}
http://jsfiddle.net/dc2jn8vk/
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