height版本︰CSS1 相容性︰IE4+ NS6+ 繼承性︰無
語法︰
height : auto |
length
參數︰
auto : 無特殊定位,根據HTML定位規則載文檔流中指派
length : 由浮點數字和單位識別符組成的長度值 | 百分數。百分數是基於父對象的高度。不可為負數。請參閱
長度單位
說明︰
檢索或設定對象的高度。
對於img對象來說,只有指定此屬性,其
width值將根據圖片源尺寸等比例縮放。
對應的腳本特性為
height。其值為一字串,所以無法使用于腳本(Scripts)中的計算。請使用style對象的
posHeight,
pixelHeight,以及對象的
offsetHeight等特性。請參閱我編寫的其它書目。
按照樣式表的規則,對象的實際高度為其下列屬性值之和︰
margin-top +
border-top +
padding-top
+ height +
padding-bottom +
border-bottom +
margin-bottom
而在IE6以前的版本,對象的實際高度卻等於︰
margin-top + height +
margin-bottom
在IE6中,已經提供了針對此問題的解決方案。而上述屬性的相互關係,請
參看圖例。
示例︰
div { height: 1in; }
div { position:absolute; top:-3px; height:6px; }
蘇沈小雨製作•保留所有權利
©2001 rain1977.comer . All rights reserved . Terms of Use .