marginRight 属性设置元素的右外边距。
</>code
- Object.style.marginRight=auto|length|%
值 | 描述 |
---|---|
auto | 浏览器设置的外右边距。 |
length | 定义固定的外右边距。默认值是 0。 |
% | 定义基于父对象总高度的百分比外右边距。 |
下面的例子改变了段落的右外边距:
</>code
- <html>
- <head>
- <style type="text/css">
- p
- {
- text-align: right
- }
- </style>
- <script type="text/javascript">
- function changeMargin()
- {
document.getElementById("p1").style.marginRight="32px";
- }
- </script>
- </head>
- <body>
- <input type="button" onclick="changeMargin()"
- value="Change the right 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>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号