您的位置:首页 > Web前端 > CSS

css3简写

2015-10-19 11:08 525 查看
1、font的简写:font:italic small-caps bold 12px/1.5em arial,verdana
等效于: font-style:italic;font-variant:small-caps;font-weight:bold;font-size:12px;line-height:1.5em;font-family:arial,verdana;
顺序:  font-style| font-variant| font-weight | font-size| line-height| font-family
注意:简写的时候,font-size 与 line-height 必须要通过斜杠/来组成一个词,不容分割
2、 background的简写:background:#fff url('images/bg.png') no-repeat fixed left top;
等效于:background-color:#fff;background-image:url('images/bg.png');background-attachment:fixed;background-position:left top;
顺序:background-color| background-image| background-repeat| background-attachment| background-position
3、margin 和 padding(它们的用法相同,我以margin来说明)
margin的简写:margin:1px 2em -23px;
等效于:margin-top:1px;margin-right:0px;margin-bottom:2em;margin-left:-23px;
顺序:margin-top| margin-right| margin-bottom| margin-left
4、 border(这是四个边框的样式)的简写:border:1px solid #000;
等效于:border-width:1px;border-style:solid;border-color:#000;
顺序:border-width| border-style| border-color
border又分为:border-top| border-right| border-bottom| border-left(上、右、下、左)
border-top:1px solid #000; 等效于:border-top-width:1px;border-top-style:1px;border-top-color:#000;

5、list-style 的简写:list-style:square outside url("images/bullet.gif");
等效于:lsit-style-type:square;list-style-position:outside;list-style-image:url('imags/bullet.gif');
顺序:list-style-type| list-style-posiiton| list-style-image
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: