中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Style marginRight 屬性

Style 對(duì)象參考手冊(cè) Style 對(duì)象

定義和用法

marginRight 屬性設(shè)置或返回元素的右外邊距。

語(yǔ)法

設(shè)置 marginRight 屬性:

Object.style.marginRight="%|length|auto|inherit"

返回 marginRight 屬性:

Object.style.marginRight
描述
% 定義基于父元素寬度的百分比右外邊距。
length 使用 px、cm 等單位定義右外邊距的寬度。
auto 瀏覽器設(shè)定的右外邊距。
inherit 右外邊距從父元素繼承。

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 marginRight 屬性。

注意:IE7 及更早的版本不支持 "inherit" 值。IE8 只有規(guī)定了 !DOCTYPE 才支持 "inherit"。IE9 支持 "inherit"。


提示和注釋

margin 屬性和 padding 屬性都是在元素周圍插入空間。然而,不同的是,margin 將圍繞邊框外面插入空間,padding 將在元素邊框內(nèi)插入空間。


實(shí)例

實(shí)例

更改 div 元素的右外邊距:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</title>
<style type="text/css">
div{
????border: 1px solid #FF0000;
}
</style>
<script>
function changeMargin(){
????document.getElementById("ex1").style.marginRight="100px";
}
function changePadding(){
????document.getElementById("ex2").style.paddingRight="100px";
}
</script>
</head>
<body>

<div id="ex1">這是一些文本。這是一些文本。這是一些文本。這是一些文本。這是一些文本。這是一些文本。這是一些文本。</div>
<br>
<button type="button" onclick="changeMargin()">修改div元素的右部外間距</button>
<br>
<br>
<div id="ex2">這是一些文本。這是一些文本。這是一些文本。這是一些文本。這是一些文本。這是一些文本。這是一些文本。</div>
<br>
<button type="button" onclick="changePadding()">修改div元素的右部?jī)?nèi)間距</button>

</body>
</html>

運(yùn)行代碼 ?

Style 對(duì)象參考手冊(cè) Style 對(duì)象其他擴(kuò)展