选择一个没有某个类别的孩子的元素 [英] Selecting an element that doesn't have a child with a certain class
本文介绍了选择一个没有某个类别的孩子的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的HTML的结构是这样的
The structure of my HTML is like so
<div>
<div>
<h1>Something</h1>
</div>
<div>
<h1 class='Handle'>Something</h1>
</div>
</div>
如果 div>div
没有一个带有"Handle"类的孩子,我想要 div>div
设置为 cursor:move;
样式.我怎么会用纯CSS做到这一点,甚至有可能吗?
In the event that the div > div
does not have a child with the class "Handle" I want the the div > div
to have the style cursor:move;
. How would I go about doing this in pure CSS, is it even possible?
推荐答案
当前没有浏览器支持此功能
此将起作用,但据我所知,目前没有浏览器支持它.jQuery确实可以.
No browser currently supports this
This would work, except no browser currently supports it as far as I am aware. jQuery does though, however.
div > div:not(:has(h1.Handle)) {
cursor: move;
}
这篇关于选择一个没有某个类别的孩子的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文