【发布时间】:2011-04-10 16:06:05
【问题描述】:
我有一个如下所示的页面:
<div>
<p> This text appears above the image</p>
<!-- I know the <div><p> construction is superfluous. I was just trying things out -->
</div>
<div style="display: block; width: 100%; clear: both;">
<img class="left" alt="Img1" src="img1.jpg" alt="" width="242" height="181" />
<img class="right" alt="Img2" src="img2.jpg" alt="" width="242" height="181" />
</div>
<div>
<p> This text appears between those images. I want it to display below them.</p>
</div>
每张图片都有这个 CSS:
.left {
float: left;
margin-right: 5px;
}
.right {
float: right;
margin-left: 5px;
}
我怎样才能使这两个图像彼此相邻浮动,但文本不会在这些图像之间换行?
当前页面的ASCII艺术:
my text my text my text my textmy text
my text my text my textmy text my text
--------- text is wrapping ---------
| IMG | text is wrapping | IMG |
--------- text is wrapping ---------
my text my text my text my textmy text
my text my text my textmy text my text
我想要的美丽的 ASCII 艺术:
my text my text my text my textmy text
my text my text my textmy text my text
--------- ---------
| IMG | | IMG |
--------- ---------
text is wrapping text is wrapping text
is wrapping
my text my text my text my textmy text
my text my text my textmy text my text
【问题讨论】: