CSS继承不应用样式

时间:2012-09-07 15:48:47

标签: css extjs4.1

所以我有以下DOM结构,我专注于突出显示的类。

enter image description here

我想更改文本“Contributing to Aggregate”白色的颜色。我在顶级项目上放置了一个“标记”CSS类(称为fmg-white)(以从页面上的其他人识别该元素的这个实例)。我创建了第二个CSS规则(.x4-form-field .fmg4-html-box .fmg-white),我认为它会将'marker'类与较低级别的应用类结合使用(.x4-form-field) .fmg4-html-box)专门针对DIV中的文本。但那并没有发生...... (标记是由extjs4发出的)

感谢任何帮助。

.fmg-white
{
    /* marker */
}

.x4-form-field .fmg4-html-box .fmg-white
{
    color: White !important;
}

1 个答案:

答案 0 :(得分:0)

您正在错误地应用选择器:

.fmg-white .x4-form-field.fmg4-html-box
{
    color: White !important;
}

.fmg-whitediv.x4-form-field.fmg4-html-box

的祖先

如果您想要的项目有多个类,则链接它们而不是将它们分开。

空格(在两个选择器之间)表示下一个项目将是前一个项目的后代。

即。 html div会为网页上的所有div设置样式,但#myDiv div只会设置#myDiv

后代的div
相关问题