CSS中的属性缩写

Font 字体缩写 

font: font-style | font-variant | font-weight | font-size | line-height | font-family

例: p{font:italic normal bold 12pt/18pt 宋体;}
          不需要的参数可以用 normal 代替,因为CSS中各个属性的值写法并不是都相同,因此直接去掉某个参数不会影响顺序与值的关系.
          本例中12pt/18pt指的是font-size字号与line-height行高,使用反斜杠分割因为font-size与line-height的值有可能使用同一计量单位,为了保证CSS对两个值所对应的属性一致,必须使用反斜杠来分割两个数值.

padding margin(上左下右)

margin: margin-top | margin-right | margin-bottom | margin-left
padding:padding-top | padding-right | padding-bottom | padding-left

p{margin:20px;} 单独使用一个参数,将表示P对象周围的外边距都为20px.
p{margin:20px 10px;}使用两个参数是非常特殊的写法,表示对上下或者左右的样式控制,当前样式表示p对象的上下边距为20px,而左右边距为10px.
p{margin:20px 10px 100px;}使用3个参数表示上边距为20px,左右边距为10px,下边距为100px.
p{margin:120px 20px 10px 80px;}4个参数则是margin属性的完整写法表示 top:120px right:20px bottom:10px left:80px

padding与margin设置方法完全相同

Border边框缩写

border: border-width | border-style | color
border-top(top,right,bottom,left):border-width | border-style | color
border-width(width,color,style):top | right | bottom | left

list缩写

list-style: list-style-type | list-style-position | list-style-image

例: ul{list-style:disc outside none;}

background背景缩写

background: background-color | background-image | background - repeat | background-attachment | background-pasition

例: #content{background:#EDEDED url(img/bg.gif) no-repeat 30% 20px;}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值