Last Updated: February 25, 2016
·
9.56K
· ferspeak

Align vertically and horizontally image inside figure

Easy and fast image alignment within the tag figure (or whatever you want).

HTML:

<figure>
   <img src="path/to/image.jpg" alt="Image">
</figure>

CSS:

figure {
width: 400px;
height: 250px;
line-height: 250px;
text-align: center;
}

img {
vertical-align: middle;
}