列表中垂直对齐的文本和图像 [英] Vertical Aligned Text and Image in list
本文介绍了列表中垂直对齐的文本和图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以使文本和列表中的图像垂直对齐?
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;}
如果文本适合一行
这篇关于列表中垂直对齐的文本和图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文