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

CSS
CSS2 Aural
CSS 单位
CSS 颜色
CSS 颜色值
CSS 颜色名称
CSS 编码与组织技巧
CSS 模块化设计思路
CSS完美兼容IE6/IE7/FF的通用方法
CSS @ Ten: 下一个重要的东西

CSS padding属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 351 ::
收藏到网摘: 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

登陆 | 还没注册?