Aligning images in text
If you need to nicely align and image in a line of text here’s how you do it
.inline-img {
/* Firefox */
vertical-align:middle;
display:-moz-inline-block;
display:-moz-inline-box;
/* Everybody else */
display:inline-block;
}
Presto!






Got an example of the output?
Comment by Cameron Manderson — March 2, 2007 @ 10:31 pm
Yeah sure:
Here is an image
inserted between text. Notice how the image sits on the baseline?
with our inline styles applied. See how the image is centred in the paragraph?
Here is the same image
Comment by Richard Lee — March 5, 2007 @ 9:33 am