To vertically align text with the middle of an image in HTML code, you can add a style parameter with a vertical-align property to the
img
tag,
e.g. style="vertical-align: middle;"
to align the text with the
middle of the image. You can use "top" or "bottom", instead, if you
wished to have the text appear at the side of the image, but aligned
with the top or bottom of the image.
<img src="Schloss-Moyland-2013-02.jpg" alt="Moyland Castle, side view"
width="500" height="691" style="padding:10px; vertical-align: middle;">
<a href="http://en.wikipedia.org/wiki/Moyland_Castle"> Moyland
Castle</a>, side view.
E.g., the above code would produce the following result:
Moyland Castle, side view.
Note: the above image is available at Wikimedia Commons here. It was a featured picture for October 2, 2013. The image was provided by Tuxyso and is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license, so anyone is free to use it or redistribute it.