Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CSS html*除了一些类?_Html_Css - Fatal编程技术网

CSS html*除了一些类?

CSS html*除了一些类?,html,css,Html,Css,我想把它应用到所有的事情上,除了一个特定的类和它的子类 html * { box-shadow: none !important; border: none !important; color: white; } 我试过了,但没用 html *:not(.myclass *) { box-shadow: none !important; border: none !important; color: white; } 这不是对你所问问题的直接回答,但最

我想把它应用到所有的事情上,除了一个特定的类和它的子类

html * {

 box-shadow: none !important;
 border: none !important;
 color: white;

     }
我试过了,但没用

html *:not(.myclass *) {

 box-shadow: none !important;
 border: none !important;
 color: white;

     }

这不是对你所问问题的直接回答,但最好是:

html * {    
 box-shadow: none;
 border: none;
 color: white;
}
然后在需要它的类中重写它,例如

.myclass {
    color:blue;
}
这是您可能期望找到它的更多方式。请注意,我从第一个*说明符中删除了“重要”声明,因为这会使将来可能重写的内容更加困难。

只需在
主体和
*
之间添加
:not(.myclass)
选择器,并且在
*:not(.myclass)

body:not(.myclass)*:not(.myclass){
盒影:无!重要;
边界:没有!重要;
颜色:红色;
}

测试1
测试2
测试3
测试4

你也能给我们看看你的HTML吗?哈哈,我知道怎么做,我只是想知道是否有更快的方法lol@Slown1970-请注意,现在更新整个声明可能会更快,但它可能会在未来几个月减慢您的速度。如果您添加一个额外的包装,这将失败:。。而且不需要使用
*