I'm trying to vertically center
an image inside a div
that is floated left
, and that has a min-height
of 150px
;
Problem is, nothing I try works. I tried everything from using display:table
for the other div
and using display:table-cell
for the inner one, but everything stays the same.
The images that appear inside the div
don't have a fixed height, but will be cut down to 150px on the server.
How can I get this to work?
![<!DOCTYPE HTML>
<html>
<head>
<title>The annoying image</title>
</head>
<body>
<div style="border:1px solid #ddd; float:left; height:150px; padding:10px; display: table;">
<img src="/imgur/us/thumb_1.jpg" style="display: table-cell; vertical-align: middle; text-align: center;">
</div>
</body>
</html>