如何为除一个类之外的所有元素创建css规则? [英] How to create a css rule for all elements except one class?
本文介绍了如何为除一个类之外的所有元素创建css规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为我的项目创建了一个CSS样式表。有没有什么办法我可以创建一个css规则,适用于所有表元素的EXCEPT表元素属于类dojoxGrid?例如:
I have created a CSS stylesheet for my project. Is there any way I can create a css rule that applies to all table elements EXCEPT table elements belonging to the class "dojoxGrid"? Something like:
.not(dojoxGrid) table{
width:100%;
border-top:1px solid #dddddd;
border-left:1px solid #dddddd;
border-right:1px solid #dddddd;
margin:1em auto;
border-collapse:collapse;
}
推荐答案
negation pseudo-class 似乎是您要查找的内容。
The negation pseudo-class seems to be what you are looking for.
table:not(.dojoxGrid) {color:red;}
这篇关于如何为除一个类之外的所有元素创建css规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文