> HTML DOM marginBottom 属性

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>
参考手册

W3c0.com 提供的内容仅用于培训。我们不保证内容的正确性。通过使用本站内容随之而来的风险与本站无关。W3c0 简体中文版的所有内容仅供测试,对任何法律问题及风险不承担任何责任。 当使用本站时,代表您已接受了本站的使用条款和隐私条款。版权所有,保留一切权利。 鲁ICP备15022115号