如何在CSS选择器中仅排除特定节点的递归子级?

问题描述 投票:1回答:1

请帮助选择特定案例。

我有一个ID为id ='map-container'的DIV,此DIV中还有其他不同的元素。

[我的目标是:使用CSS,请完全选择我HTML中的所有元素,但ID为'map-container'的该DIV的所有子元素除外(递归)。

所以,如果我有例如:

<body>
<div ...>
 some other divs
</div>
<div ...>
 some other divs
</div>
<div ...>
 some other divs
</div>
[<div id="map-container">
 some other divs
</div>]
</body>

仅应选择[]中的部分。

非常感谢您!

css select xpath css-selectors
1个回答
1
投票

兄弟,您只需要排除此元素,只需使用“ unset”值覆盖所需的样式即可。也许这会有所帮助。

#map-container * {
    css-style: unset;
}
© www.soinside.com 2019 - 2024. All rights reserved.