覆盖 Dojo 中的 css 属性



我正在使用增强的网格Dojo 1.10版本。我的问题很简单,但我仍然无法解决它。我需要应用背景色 css 属性 到表行。但是问题在于已经将背景属性应用于该行,该属性也具有背景颜色。如果我从控制台中删除该属性,我的背景颜色会正确反射。

我试图覆盖它,改变它,但没有一个有效。实际上,应用的类并不是直接直接的。像这样的东西

.claro .dojoxGridRowTable tr {
background-image : url("...")
background-repeat : repeat-x;
background-attachment :scroll;
background-clip:border-box;
background-origin:padding-box;
background-size:auto auto;
}

如何覆盖此类。谁能在这里帮我。

问题的根源在于特异性。您可以在此处阅读有关它的更多信息。

基本上,您在CSS中使用的选择器越多,它的特异性排名就越高。例如

.text-title {}

不是很具体。

.label-text .text-title {}

更具体,将优先。

.label .label-text .text-title {}

更具体。和:

div.label > .label-text > .text-title {}

甚至更加具体,并将优先于所有其他。

所以这个问题的解决方案是你的CSS需要比Dojo CSS更具体。只需在自定义 CSS 中使用更具体的。

不幸的是,在许多情况下,您可能会看到带有 !important 的属性,因此您也将被迫使用它来覆盖它们的属性。

在CSS属性上使用!important:

.claro .dojoxGridRowTable tr {
background-image : url("...") !important;
background-repeat : repeat-x !important;
background-attachment :scroll !important;
background-clip:border-box !important;
background-origin:padding-box !important;
background-size:auto auto !important;
}

最新更新