css教程:CSS边距margin属性的应用

The CSS margin properties define the space around elements.
CSS的边距属性定义元素四周的空间范围

设置文字左边距 Set the left margin of a text
This example demonstrates how to set the left margin of a text.
Examples 实例:
代码调试框 [www.dedecms.com]
[ 可先修改部分代码 再运行查看效果 ]

设置文字右边距 Set the right margin of a text
This example demonstrates how to set the right margin of a text.
Examples 实例:
代码调试框 [www.dedecms.com]
[ 可先修改部分代码 再运行查看效果 ]

设置文字顶边距 Set the top margin of a text
This example demonstrates how to set the top margin of a text.
Examples 实例:
代码调试框 [www.dedecms.com]
[ 可先修改部分代码 再运行查看效果 ]

设置底部边距 Set the bottom margin of a text
This example demonstrates how to set the bottom margin of a text.
Examples 实例:
代码调试框 [www.dedecms.com]
[ 可先修改部分代码 再运行查看效果 ]

快速设置四边边距 All the margin properties in one declaration
This example demonstrates how to set a shorthand property for setting all of the margin properties in one declaration.
Examples 实例:
代码调试框 [www.dedecms.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填充,所以要让页面在几个不同主流浏览器上的效果都相同就需要将属性设置妥当!

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

Grow your business fast with

Suku