CSS简写

1.颜色的简写

4种表现:

color:#FF000;(RR/GG/BB三组颜色值成对,可简写为#F00)

color:RGB(255,0,0);/ color:RGB(100%,0,0);

color:red;

color:windowtext;background-color:background;(用户系统色盘值) 

2.padding和margin上右下左的简写
3.border的简写

border-width:1px;

border-style:solid;

border-color:red;

上面可简写为:

border:1px solid red;

4.background的简写

background-color:red;

background-image:url(background.jpg);

background-repeat:no-repeat;

background-attachment:fixed;

background-position:0 0;

上面可简写为:

background:red url(background.jpg) no-repeat fixed 0 0;

background属性默认值为:

background-color:transparent;

background-image:none;

background-repeat:no-repeat;

background-attachment:scroll;

background-position:0% 0%;

5.font的简写

font-style:italic;

font-variant:small-caps;

font-weight:bold;

font-size:12px;

line-height:140%;

font-family:”LucidaGranda”,sans-serif;

上面可简写为:

font:italicsmall-caps bold 12px/140% “Lucida Granda”,sans-serif;

font属性默认值为:

font-style:normal;

font-variant:normal;

font-weight:normal;

font-size:medium;

line-height:normal;

font-family:”TimesNew Roman”;

6.ul和ol表的简写

li{

    list-style-image:url(background.jpg);

    list-style-position:inside;

    list-style-type:square;

}

可以简写为:

li{

    list-style:url(background.jpg)inside square;

}

系统默认值为:

list-style-image:none;

list-style-position:outside;

list-style-type:disc;


注:上面内容引自《CSS那些事这本书》
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值