不要设计整个 div
Not to style an entire div
如果我有一个 div 和一个 class='myDiv'
之类的东西,那么是否可以在样式表中创建一个非选择器而不在 div 中设置任何样式?
在我的特殊情况下,我说的是 div 中的表、th、tr 和 td。
table:not([class='myDiv'])
thead tr:not([class='myDiv'])
tr:not([class='myDiv'])
td:not([class='myDiv'])
与此类似的东西,以便所讨论的样式不会影响 div 中的元素 class?
编辑:在我之前的问题中,您可能会看到我正在尝试做什么。问题是我想更改一个外部样式表(在整个网站上使用),使其在网站的其余部分仍然像现在一样工作,但不应该设置我的日历表的样式。
很遗憾,您无法引用父元素。
反过来:
.allOtherClasses:not(.specialClassDiv) table{
/*
Anything here will style the TABLE elements inside .allOtherClasses
but not the TABLE inside .specialClassDiv
*/
}
如果我有一个 div 和一个 class='myDiv'
之类的东西,那么是否可以在样式表中创建一个非选择器而不在 div 中设置任何样式?
在我的特殊情况下,我说的是 div 中的表、th、tr 和 td。
table:not([class='myDiv'])
thead tr:not([class='myDiv'])
tr:not([class='myDiv'])
td:not([class='myDiv'])
与此类似的东西,以便所讨论的样式不会影响 div 中的元素 class?
编辑:在我之前的问题中,您可能会看到我正在尝试做什么。问题是我想更改一个外部样式表(在整个网站上使用),使其在网站的其余部分仍然像现在一样工作,但不应该设置我的日历表的样式。
很遗憾,您无法引用父元素。
反过来:
.allOtherClasses:not(.specialClassDiv) table{
/*
Anything here will style the TABLE elements inside .allOtherClasses
but not the TABLE inside .specialClassDiv
*/
}