列表中垂直对齐的文本和图像

问题描述:

有没有一种方法可以使文本和列表中的图像垂直对齐?

Is there a way of vertical aligning text and an image in a list?

例如

<li>Some text here <img src="image.jpg" alt="" /></li>

文本未在图像侧面的中间对齐,出现在底部,然后图像在其旁边.我需要文本位于侧面图像之间的中心点.

The text doesn't align in the middle of the side of the image, it appears at the bottom then the image is next to it. I need the text to be in the center point between the image on the side.

做这件事的最好方法是什么?我知道在列表中包含图片不是有效的HTML(AFAIK).

What's the best way of doing it? I know having a image inside a list isn't valid HTML (AFAIK).

谢谢:)

您可以使用

li img {vertical-align: middle;}

如果文本适合一行