The CSS margin properties define the space around elements.
CSS的边距属性定义元素四面的空间范围 设置文字左边距 Set the left margin of a textThis example demonstrates how to set the left margin of a text.
Examples 实例:
Source Code to Run
[www.21shipin.com] 设置文字右边距 Set the right margin of a textThis example demonstrates how to set the right margin of a text.
Examples 实例:
Source Code to Run
[www.21shipin.com] 设置文字顶边距 Set the top margin of a textThis example demonstrates how to set the top margin of a text.
Examples 实例:
Source Code to Run
[www.21shipin.com] 设置底部边距 Set the bottom margin of a textThis example demonstrates how to set the bottom margin of a text.
Examples 实例:
Source Code to Run
[www.21shipin.com] 快速设置四边边距 All the margin properties in one declarationThis example demonstrates how to set a shorthand property for setting all of the margin properties in one declaration.
Examples 实例:
Source Code to Run
[www.21shipin.com] The CSS margin properties define the space around elements. It is possible to use negative values to overlap content. The top, right, bottom, and left margin can be changed independently using separate properties. A shorthand margin property can also be used to change all of the margins at once.
CSS边距定义元素四面的空间范围。它可让内容重叠。也可用分离的属性分别对上,下,左,右进行样式改变。用margin属性可以快速的设置所有边距。
Note: Netscape and IE give the body tag a default margin of 8px. Opera does not! Instead, Opera applies a default padding of 8px, so if one wants to adjust the margin for an entire page and have it display correctly in Opera, the body padding must be set as well!
注重: 网景和IE默认给body标签加上了8px的边距。OPERA就没有这样的情况,相反的,OPERA有个默认的8px填充,所以要让页面在几个不同主流浏览器上的效果都相同就需要将属性设置妥当!