当前位置: 首页 > 网络学院 > 网页制作基础教程 > CSS > CSS 填充
The CSS padding properties define the space between the element border and the element content.
CSS填充属性定元素边框到内部内容间的距离
Set the left padding
This example demonstrates how to set the left padding of a tablecell.
设置左填充
Set the right padding
This example demonstrates how to set the right padding of a tablecell.
设置右填充
Set the top padding
This example demonstrates how to set the top padding of a tablecell.
设置上填充
Set the bottom padding
This example demonstrates how to set the bottom padding of a tablecell.
设置底部填充
All the padding properties in one declaration
This example demonstrates a shorthand property for setting all of the padding properties in one declaration, can have from one to four values.
快速设置所有填充属性
The CSS padding properties define the space between the element border and the element content. Negative values are not allowed. The top, right, bottom, and left padding can be changed independently using separate properties. A shorthand padding property is also created to control multiple sides at once.
可用padding属性快速设置各方向填充的属性
Browser support: IE: Internet Explorer, F: Firefox, N: Netscape.
浏览器支持:IE: Internet Explorer, F: Firefox, N: Netscape
W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2).
W3C:里面的数字代表CSS版本号
Property属性 | Description描述 | Values值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
padding | A shorthand property for setting all of the padding properties in one declaration 一种可针对所有填充属性进行一次声明的速记属性 | padding-top padding-right padding-bottom padding-left | 4 | 1 | 4 | 1 |
Sets the bottom padding of an element 设置元素的底填充 | length % | 4 | 1 | 4 | 1 | |
Sets the left padding of an element 设置元素的左填充 | length % | 4 | 1 | 4 | 1 | |
Sets the right padding of an element 设置元素的右填充 | length % | 4 | 1 | 4 | 1 | |
padding-top | Sets the top padding of an element 设置元素的顶部填充 | length % | 4 | 1 | 4 | 1 |