css样式缩写

CSS样式缩写

css样式分开写太过繁琐,故经查找资料后总结如下:

1、background缩写方式

 background:background-color | background-image | background-repeat | background-attachment | background-position.

background: #aaaaaa url(../image/logo..jpg) no-repeat -50px 50px;
等价形式为:

background-color:#aaaaaa;
background-image:url(../image/logo.jpg);
background-repeat:no-repeat;
background-position:-50px 50px;
2、font缩写方式

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

font:italic small-caps bold 20px/40px Arial;
等价形式为:

font-style:italic;
font-variant:small-caps;
font-weight:bold;
font-size:20px;
line-height:40px;
font-family:Arial;
3、border缩写方式

border : border-width | border-color | border-style.(谁在前,谁在后都一样)

border: 1px #ffaadd solid;
等价形式为:

border-width:1px;
border-color:#ffaadd;
border-style:solid;
4、margin&padding缩写形式

margin: top | right | bottom | left.

margin:10px 10px 10px 10px;

等价形式为:

margin-top:10px;
margin-right:10px;
margin-bottom:10px;
margin-left:10px;

margin:top(bottom) | right(left).  (第一个值代表上下,第二个值代表左右)

margin:10px 10px;
margin:top(right/bottom/left);  (四个属性值相同)

margin:10px;
padding的简写和margin一样。









评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值