我有一个奇怪的问题。本着尝试编写DRYer,更短代码的精神,我想从我个人的h3样式中删除'不重复',并且只用一个声明来完成。以下是失败代码的示例版本。 #c中的h3固执地不会停止重复,除非我像#a和#b那样设置它。
我试过替换背景重复:没有:没有重复,但没有运气。在此先感谢您的帮助!为什么我不能停止背景重复:从重复?
.class > h3
{
float:left;
height:21px;
width:200px;
margin-bottom:10px;
}
#a > h3 {background:url(a.png) no-repeat;}
#b > h3 {background:url(b.png) no-repeat;}
#c > h3 {background:url(c.png);}
/* EDIT: this code does not work (even after applying Thom's answer)
h3 {background-repeat:none;}
*/
h3 {background-repeat:no-repeat;}
那么,一切正常了!谢谢汤姆。我有一种感觉,这是沿着这条线。 – 2010-08-11 18:10:27