css - 垂直对齐 CSS 属性

标签 css vertical-alignment

这似乎是一个非常简单的问题,但到目前为止它一直困扰着我。垂直对齐属性对我来说工作正常。但是,当我在要沿图像中心排列的文本后添加
标记时,
标记后的任何文本都会直接显示在图像下方。

例子:

<img src="test.png" width="50" height="50" alt="test" style="vertical-align:middle;"/>        This text is fine. <br />This text is not.

最佳答案

试试这个:

<img src="test.png" width="50" height="50" alt="test" style="vertical-align:middle;"/>        

<div style='display:inline-block; vertical-align:top;'> 
    <span style='display:inline-block;vertical-align:middle;'>This text is fine. <br />This text is not.
</div>

关于css - 垂直对齐 CSS 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10294094/

相关文章:

css - 带有表格单元格父级和绝对定位伪元素的 IE 垂直居中错误

javascript - CSS 中的垂直对齐?

html - 我想使用垂直对齐 :middle

html - 在移动 View 中将 Bootstrap 卡居中

javascript - CSS 当使用溢出时,差距仍然存在

html - 保持 html 位置固定并带有背景图像

html - Chrome 中 float LI 包装内的链接

css - 如何使用 Vue.js 在 CSS 网格中显示元素

html - CSS 垂直对齐

html - CSS:如何垂直对齐对象,以便增加标签的字体大小不会丢失所有内容?