I am struggling to vertically center the text alongside an image on my website. Despite my efforts, I can't seem to get it right. Do you have any suggestions on why this might be happening? I've tried searching for a solution but haven't had any luck so far. Any help would be greatly appreciated! Thank you!
(Please adjust the width of the results window to better visualize the issue.)
Check out the code on JSFiddle.
Here is the HTML:
<div class="first">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque varius pulvinar imperdiet. Cras quam orci, <br>
Duis vulputate risus rutrum, elementum purus non,</p>
<img class="ipad" src="http://www.technobuffalo.com/wp-content/uploads/2012/12/ipad-mini-scaled-1.jpg">
</div>
And here is the CSS:
p {
margin: 0;
padding: 1em 0;
font-size: 1.8em;
line-height: 1.5;
}
.first {
height: 100%;
vertical-align: middle;
line-height: 0;
}
.first p {
display: inline-block;
width: 49%;
}
.ipad {
display: inline-block;
width: 49.2%;
}