当前位置: 首页 > 网络学院 > 网页制作基础教程 > CSS > CSS padding属性

CSS
CSS 介绍
CSS 语法
使用 CSS
CSS 背景
CSS 文字
CSS 字体
CSS 边框
CSS 边距
CSS 填充
CSS 列表
CSS 尺寸
CSS 类别
CSS 定位
CSS 伪类
CSS 伪元素
CSS2 Media类型
CSS 摘要
CSS 实例
CSS2 参考资料
CSS2 打印

CSS padding属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 350 ::
收藏到网摘: n/a

The padding property is a shorthand property for setting all of the padding properties in one declaration.
padding 属性为用一句声明便可设置所有填充属性的速记法属性

Note: Negative values are not allowed.
注意:不可以使用负数值

Inherited: No
继承性:无

举例

h1 {padding: 10px}
the padding will be 10px on all four sides
所有四个边的填充都为10px

h1 {padding: 10px 2%}
top and bottom padding will be 10px, left and right padding will be 2% of the width of the closest element.
上下填充为10px ,左右填充为2%

h1 {padding: 10px 2% 15px}
top padding will be 10px, left and right padding will be 2% of the width of the closest element, bottom padding will be 15px
上填充为10px,左右填充为2%,下填充为15px

h1 {padding: 10px 2% 15px 20px}
top padding will be 10px, right padding will be 2% of the width of the closest element, bottom padding will be 15px, left padding will be 20px
上填充为10px ,右填充为2%,下填充为15px ,左填充为20px

可用值

描述
padding-top
padding-right
padding-bottom
padding-left
Sets the padding. The values comes in % (defines padding in % of the width of the closest element) and length (defines a fixed padding)
设置填充。值可以为%以及固定的数值

评论 (0) All

登陆 | 还没注册?