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

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!
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.mb5u.com]

[ 可先修改部分代码 再运行查看效果 ]


设置文字右边距 Set the right margin of a text
This example demonstrates how to set the right margin of a text.
Examples 实例:
代码调试框 [www.mb5u.com]

[ 可先修改部分代码 再运行查看效果 ]


设置文字顶边距 Set the top margin of a text
This example demonstrates how to set the top margin of a text.
Examples 实例:
代码调试框 [www.mb5u.com]

[ 可先修改部分代码 再运行查看效果 ]


设置底部边距 Set the bottom margin of a text
This example demonstrates how to set the bottom margin of a text.
Examples 实例:
代码调试框 [www.mb5u.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.mb5u.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填充,所以要让页面在几个不同主流浏览器上的效果都相同就需要将属性设置妥当!

来源:无忧整理//所属分类:CSS教程/更新时间:2006-11-09
相关CSS教程