<style>
.floatright { float: right;margin: 0 0 10px 10px;clear: right;width:60px; height:60px; }
</style>
<img class="floatright" src="computer1.png" alt="" width="60" height="60">
<img class="floatright" src="computer2.png" alt="" width="60" height="60">
<img class="floatright" src="computer3.png" alt="" width="60" height="60">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
</p>
這裏clear: right;
將獲得的圖像堆疊在彼此的頂部,但爲什麼不能用clear: left;
,根據這裏:http://www.w3schools.com/cssref/pr_class_clear.asp,這是說:
clear:left, No floating elements allowed on the left side
所以這意味着如果使用clear:left
在.floatright
,允許在每個圖像的左側沒有浮動的元件,因此,所有的圖像將堆疊在彼此的頂部上,但實際上不是, clear:left
不做任何事情,爲什麼?
試過'clear:both;'? –
感嘆。 w3schools再次錯誤*。 – Alohci