简体   繁体   English

jQuery - 禁用 :not 选择器 CSS

[英]jQuery - disable :not selector CSS

There's a certain CSS property that I want to remove, but I can't because it is auto-generated by a backend engine called Pelican.我想删除某个 CSS 属性,但我不能删除,因为它是由名为 Pelican 的后端引擎自动生成的。

.rendered_html ul:not(.list-inline) {
    padding-left: 2em;
}

I want to remove this property, but I don't know how.我想删除此属性,但我不知道如何删除。 Here's the screenshot这是屏幕截图

在此处输入图片说明

In a Chrome developer tool, if I uncheck that property, it works fine, but if I leave it as it is, it looks bad.在 Chrome 开发人员工具中,如果我取消选中该属性,它工作正常,但如果我保持原样,它看起来很糟糕。 And the thing I don't understand is that both appear as greyed out in chrome developer tool, and yet they seem to have effects on the CSS property.我不明白的是,两者在 chrome 开发人员工具中都显示为灰色,但它们似乎对 CSS 属性有影响。 To my understanding, if the properties are greyed out, they should not have any effects, but in this case they do.根据我的理解,如果属性变灰,它们不应该有任何影响,但在这种情况下它们会产生影响。

I tried doing this:我尝试这样做:

.rendered_html ul:not(.list-inline) {
    padding-left: unset !important;
}

But this is not what I want because I want it, because I also want to add this property:但这不是我想要的,因为我想要它,因为我也想添加这个属性:

ul.ascii {
    padding: 1rem;
}

Unsetting the padding by adding additional CSS codes in my .css file will prevent me from applying padding: 1rem property.通过在我的 .css 文件中添加额外的 CSS 代码来取消填充将阻止我应用padding: 1rem属性。

How can I nullify the css proprety of .rendered_html ul:not(.list-inline) ?如何取消.rendered_html ul:not(.list-inline)的 css 属性?

not ideal, but不理想,但

.rendered_html ul:not(.list-inline) {
    padding-left: 0 !important;
}

.rendered_html ul.ascii {
    padding: 1rem !important;
}

will likely solve your problem.可能会解决您的问题。

the adding of the extra step .rendered_html on the second instruction gives it the same specificity hierarchy as the first one, so it wont be ignored.在第二条指令上添加额外的步骤.rendered_html使其具有与第一条相同的特异性层次结构,因此不会被忽略。

you might not need !important depending on .css loading order, so try to change that too.根据 .css 加载顺序,您可能不需要!important ,因此也尝试更改它。

https://developer.mozilla.org/en-US/docs/Web/CSS/Specificityhttps://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM