Wednesday, October 10, 2007

Image alignment in HTML / CSS

Let's assume you have a line that starts with an image with text to the right of it. By default the image and text are vertically aligned to the bottom of the image and the baseline (bottom except for letters like g, j, y, etc) of the text. To make the image be centered on the line of text you do the following.

<img border="0" src="myImage.gif" style="vertical-align:middle"/>my text that is to the right of the image.

No comments: