I've been running into an issue trying to vertically center an image and text together. I cannot get the image to align with the text, and even when I think it is centered, changing the browser size ruins it.
.icon-button-with-text-wrapper {
border: 1px solid #7e898a;
background-color: white;
box-sizing: border-box;
display: table;
margin-top: 10px;
padding: 10px;
font-size: 1.5em;
width: 100%;
height: 100%;
}
.icon-button-with-text-wrapper img {
margin-right: 10px;
max-height: 50px;
max-width: 50px;
vertical-align: middle;
float: left;
}
p {
vertical-align: middle;
}
}
<div class="icon-button-with-text-wrapper"><img typeof="foaf:Image" src="http://i.imgur.com/YjcaGSx.png" width="100" height="100" style="
padding-top: 10p;
" align="middle"><p>Speak to an Admissions Counselor<p></div>
I've tried vertical-align: middle
, display: table-cell
(and others), and different positions, along with adjusting the height, margins, etc. I've also looked at several other similar questions such as this one, this one and this one. However, none of those offered a solution that worked in this instance.