請看下面的代碼:
1
< html >
2
< head >
3
< script language ="javascript" >
4
</ script >
5
< style type ="text/css" >
6
</ style >
7
</ head >
8
< body >
9
< div style ="position:absolute;top:100px;left:100px;width:300;height:300;background-color:#99FF00" >
10
< div style ="float:left;width:100;height:100;background-color:red" ></ div >
11
< div style ="clear:right;height:100;background-color:blue;" ></ div >
12
</ div >
13
</ body >
14
</ html >
float : none |
left |
right 參數: none : 對象不浮動
left : 對象浮在左邊
right : 對象浮在右邊
說明:該屬性的值指出了對象是否及如何浮動。
當該屬性不等于none引起對象浮動時,對象將被視作塊對象(block-level),即display屬性等于block。也就是說,浮動對象的display特性將被忽略。
對應的腳本特性為styleFloat。
clear : none |
left |
right |
both 參數: none : 允許兩邊都可以有浮動對象
both : 不允許有浮動對象
left : 不允許左邊有浮動對象
right : 不允許右邊有浮動對象
說明: 該屬性的值指出了不允許有浮動對象的邊。
對應的腳本特性為
clear。