我有一個網頁,它看起來像這樣:禁用文字環繞周圍浮動圖像
<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
'溢出:自動'也可以。這是更清潔的標記。 – 2011-04-10 16:19:17
很簡單,我只花了一個小時試圖擺弄各式各樣的CSS屬性。非常感謝! – poundifdef 2011-04-10 16:24:11
非常乾淨,工作很好。 – 2011-04-10 16:47:47