Is there a way to make this selector work?

.panel-body:has(.filtered-search):not(:has(.vg-filter-pills.ng-hide))
.panel-body:has(.filtered-search):not(:has(.vg-filter-pills.ng-hide))
8 Replies
vince
vinceOP3mo ago
Nevermind, fixed the issue without making a crazy selector! Still curious though if something like this is possible 👀
ἔρως
ἔρως3mo ago
why wouldn't that work?
vince
vinceOP3mo ago
Oh does that work? My selector logic was wrong then. I thought you couldn't nest :has with a :not into another :has
ἔρως
ἔρως3mo ago
but it's not nested????
vince
vinceOP3mo ago
Nested wasn't the right term, just thought you couldn't do what I did above It's essentially :has:not:has But good to know I can do this, thanks
ἔρως
ἔρως3mo ago
you can https://jsfiddle.net/efbd8cjh/ the 2nd <p> will be red
<p>sadsa<span>sadd</span>sdsa<b>sdads</b></p>
<p>sadsa<span>sadd</span>sdsa</p>
<p>sadsa<span>sadd</span>sdsa<b>sdads</b></p>
<p>sadsa<span>sadd</span>sdsa</p>
p:has(span):not(:has(b)) {
color: red;
}
p:has(span):not(:has(b)) {
color: red;
}
vince
vinceOP3mo ago
Ohhhh cool, thank you!
ἔρως
ἔρως3mo ago
you're welcome

Did you find this page helpful?