当前位置: 首页 > 网络学院 > 网页制作基础教程 > CSS > CSS margin属性
The margin property is a shorthand property for setting all of the properties for the four margins in one declaration.
margin 速记法属性可在一句声明中设置所有四个边际的属性
Note: Negative values are allowed.
注意:可以使用负数
Inherited: No
继承性:无
h1 {margin: 10px} h1 {margin: 10px 2%} h1 {margin: 10px 2% -10px} h1 {margin: 10px 2% -10px auto} |
值 | 描述 |
---|---|
margin-top margin-right margin-bottom margin-left | Sets the properties for the margins. The values comes in % (defines a margin in % of the total height/width of the document), length (defines a fixed margin), and auto (the browser sets a margin). 设置边际属性,值可以是百分比(根据文档的宽/高来定义),长度(定义固定的边际)以及自动(由浏览器自行设定) |