HTML DOM marginBottom 屬性
定義和用法
marginBottom 屬性設置元素的下外邊距。
語法:
Object.style.marginBottom=auto|length|%
可能的值:
值 | 描述 |
---|---|
auto | 瀏覽器設置的一個下外邊距。 |
length | 定義一個固定的下外邊距。默認值是 0。 |
% | 定義基于父對象總高度的百分比下外邊距。 |
實例
本例改變段落的下外邊距:
<html>
<head>
<script type="text/javascript">
function changeMargin()
{
document.getElementById("p1").style.marginBottom="32px";
}
</script>
</head>
<body>
<input type="button" onclick="changeMargin()"
value="Change the bottom margin of a paragraph" />
<p>This is a paragraph</p>
<p id="p1">This is a paragraph</p>
<p>This is a paragraph</p>
</body>
</html>