关于CSS优化

来源:百度知道 编辑:UC知道 时间:2024/05/04 10:55:07
#links{background:url(cy/images/by-06.png); background-repeat:no-repeat; clear:both; background-position:top; padding-top:10px; height:30px}

这段代码,怎么优化,就是写成简单的格式.(但要符合CSS标准哦)
希望也把优化的思路说一下

分析:
#links{background:url(cy/images/by-06.png); background-repeat:no-repeat; clear:both; background-position:top; padding-top:10px; height:30px}
所含设置 背景 高度 内补丁 清除浮动
唯一可以优化的是背景

分析背景
background:url(cy/images/by-06.png);
background-repeat:no-repeat;
background-position:top;
背景属性
语法:
background : background-color || background-image || background-repeat || background-attachment || background-position

所以背景简写可以为

background:url(cy/images/by-06.png) no-repeat top;

继续分析 可以发现 background-position:top;属性是默认值,所以最后简写为
background:url(cy/images/by-06.png) no-repeat;