我想将主题标签集成到我的元素中,以便它们显示为不同的颜色。但由于css选择器具有相同的css特性,因此最新版本会覆盖先前定义的规则。更改儿童的特异性
这是显示我的问题的例子:
<div class="red">
<div class="box">This should be red</div>
<div class="yellow">
...
<div class="box">This should be yellow (nested in x levels under the div.yellow)</div>
...
</div>
,在这里我的CSS
.box { width: 100px; height: 100px; }
.yellow { background-color: yellow; }
.red { background-color: red; }
包装箱内应某上市,但只要它是另一种颜色的子子它应该被覆盖。
感谢您的任何帮助!
这是动态的吗?如果不是仅仅使用:class =“box yellow”作为其类 – Treby 2009-12-15 07:55:05
它是黄色的。我猜这个问题在其他地方。可能涉及。黄色浮动或.box被绝对定位的所有内容。无论问题出在哪里,它都不适用于你向我们展示的代码。 – Quentin 2009-12-20 14:02:04