0

在此处输入图像描述

如何使用 CSS(如附加的截图)垂直对齐图像旁边的文本。

例如:我在这篇文章中附上了截图。

4

4 回答 4

2

将图像向左浮动并放在overflow:hidden文本上以防止它进入图像下方。

于 2013-01-17T09:04:37.470 回答
0

为图像使用此 CSS 样式

clear:both
于 2013-01-17T09:09:28.647 回答
0

一个简单的浮点数通常可以解决问题:

img {
    float: left;
}

p {
    float: left;
}

这使文本适应图像。如果文本比图像的高度长,它将在它下面换行。

于 2013-01-17T09:10:16.960 回答
0
<p><img src="https://www.google.com/images/srpr/logo3w.png" style="float:left;padding-right:12px" width="280" />Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>
<br style="clear:both" />
<p>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

测试这个。

于 2013-01-17T09:16:34.217 回答