css代码缩写提高代码重用功能
在实体的css布局中,望望会出现很多很多多余的代码,这对速度不太用例,所以我们需要进一步的缩写来提高速度^_^看下面·······

.t1 {
    padding-top: 3px;
    padding-right: 20px;
    padding-bottom: 3px;
    padding-left: 20px;
}


缩写后的样式是:

.t1 {
    padding: 3px 20px 3px 20px;
}


padding的四边值依次对应了top(上)、right(右)、bottom(下)、left(左)。


当left(左)没有时,默认值为right(右)的值,当bottom(下)没有时,默认值为top(上)的值

.t1{
    padding: 3px 20px;
}

如果padding的值就是3px的话,就直接写成 .t1 { padding: 3px ;}就可以了


背景代码缩写:


background-color: #FFCCFF;
background-image: url(/images/2007-6.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center bottom;


缩写后是

background:#FCF url(/images/2007-6.jpg) no-repeat fixed center bottom;


即 背景:背景颜色、背景图像、背景重复、背景附件、背景水平位置、背景垂直位置


其中背景颜色“#FFCCFF”还可以简写为“#FCF”,这是针对16进制的色彩值,如果每两位(RRGGBB)的值相同,可以缩写一半(RGB)。同时,背景图像不需要加双引号。




Category: web标准 , 2008/04/30 , 09:48 , 0 Comments , 407 Read
Tags:
收藏到网摘:百度搜藏 Google书签 Del.icio.us Yahoo收藏 新浪ViVi收藏夹 365天天网摘 天极网摘 我摘·网摘·网络书签 POCO网摘 YouNote网摘 和讯网摘 Bolaa博拉博客收录中心 igooi网摘 天下图摘
发表评论
昵称 [注册]
密码 游客无需密码
网址
电邮
打开HTML 打开UBB 打开表情 隐藏 记住我