【css】css缩写

css缩写参考文档

https://developer.mozilla.org/zh-CN/docs/Web/CSS/Shorthand_properties

css缩写 能缩减大量的代码,使代码便于阅读、理解。

                1.background

background:#F00 url(header_bg.gif) no-repeat fixed left top;
 
background-color | background-image | background-repeat | background-attachment | background-position


2.font
 font:normal small-caps bold 14px/1.5em '宋体',arial,verdana;

                 font-style | font-variant | font-weight | font-size | line-height | font-family
注:简写时,font-size和line-height只能通过斜杠/组成一个值,不能分开写。

3.外边距和内边距:margin padding
margin:5px;(上/右/下/左)
margin-top | margin-right | margin-bottom | margin-left
 
margin:4px 0 1.5em -12px;(上 | 右 | 下 | 左)  
margin-top | margin-right | margin-bottom | margin-left
 
margin: 0 6px; (上/下 | 左/右)  
                 (margin-top/margin-bottom) | (margin-left/margin-right)
         
                 margin: 151px auto 0; (上 | 左/右 | 下)
                 margin-top | (margin-left/margin-right) | margin-bottom
         
               注:padding属于的简写和margin完全一样。
                 ps:关于四个边的特别说明
                 不论是边框宽度,还是边框颜色、边距等,处理和盒子(box)边界(edge)相关的属性时,
                 比如 border-style、margin 或者 padding, 始终使用一致的1个到4个值的语法表示这些边界。
        
                 
             4.border       
                border:1px solid #CCC;
        
                 border-width | border-style | border-color
        
            5.list-style
               list-style:square outside url(bullet.gif);
        
               list-style-type | list-style-position | list-style-image
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值