HTML DOM bottom 屬性
定義和用法
bottom 屬性設置定位元素下外邊距邊界與其包含塊下邊界之間的偏移。
語法:
Object.style.bottom=auto|%|length
可能的值
值 | 描述 |
---|---|
auto | 默認。通過瀏覽器計算底部的位置。 |
% | 設置元素的底邊到最近一個具有定位設置父元素的底部邊緣的百分比位置。 |
length | 使用 px、cm 等單位設置元素的底邊到最近一個具有定位設置父元素的底部邊緣的位置?墒褂秘撝怠 |
提示和注釋
Note:如果 "position" 屬性的值為 "static",那么設置 "bottom" 屬性不會產(chǎn)生任何效果。
實例
本例對元素的下邊進行設置:
<html>
<head>
<style type="text/css">
input
{
position:absolute;
}
</style>
<script type="text/javascript">
function setBottomEdge()
{
document.getElementById("b1").style.bottom="100px";
}
</script>
</head>
<body>
<input type="button" id="b1" onclick="setBottomEdge()"
value="Set bottom edge to 100 px" />
</body>
</html>