欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

HTML DOM margin 屬性

HTML DOM Style 對象參考手冊

定義和用法

margin 屬性設(shè)置元素的外邊距。

該屬性可使用 1 到 4 個值:

  • 如果規(guī)定一個值,比如 div {margin: 50px} - 所有的外邊距都是 50 px
  • 如果規(guī)定兩個值,比如 div {margin: 50px 10px} - 上下外邊距是 50px,左右外邊距是 10 px。
  • 如果規(guī)定三個值,比如 div {margin: 50px 10px 20px}- 上外邊距是 50 px,而左右外邊距是 10 px,下外邊距是 20 px。
  • 如果規(guī)定四個值,比如 div {margin: 50px 10px 20px 30px} - 上外邊距是 50 px,右外邊距是 10 px,下外邊距是 20 px,左外邊距是 30 px。

語法:

Object.style.margin=margin

可能的值:

描述
margin

設(shè)置外邊距。

值可以是:

  • 百分比(基于父對象總高度或?qū)挾鹊陌俜直龋?/li>
  • 長度值(定義一個固定的邊距)
  • auto(瀏覽器設(shè)定的值)。

實例

下面的例子改變了段落的外邊距:

<html>
<head>
<script type="text/javascript">
function changeMargin()
{
document.getElementById("p1").style.margin="100px";
}
</script>
</head>
<body>

<input type="button" onclick="changeMargin()"
value="Change margins of a paragraph" />

<p id="p1">This is a paragraph</p>

</body>
</html>

HTML DOM Style 對象參考手冊