Using the :not selector globally, is it possible?
See original GitHub issueIs there a way to use the :not()
global selector?
When using this (within a Gatsby site)
& > div:nth-of-type(1) :not(ul) a {
/* ... */
}
it gets transformed into (without spacing before the :not()
)
& > div:nth-of-type(1):not(ul) a {
/* ... */
}
(here there’s a fiddle showing the consequence of this) https://jsfiddle.net/qzxcyw0s/1/
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Global selector combined with :not(.class) doesn't seem to work
I used this selector, main *:not(.no-material) input , which, to me, should work and select the last 4 input s, but it doesn't....
Read more >How Not Selector Works in CSS? - eduCBA
When we are working with CSS :notselector, it does not match all the elements that are excluded from CSS application. The CSS:no selector...
Read more >CSS Pseudo-classes: :not() and :target - SitePoint
Any argument passed to :not() must be a simple selector such as an element type, a class name, an ID, or another pseudo-class....
Read more >not() - CSS: Cascading Style Sheets - MDN Web Docs
The :not() CSS pseudo-class represents elements that do not match a list of selectors. Since it prevents specific items from being selected, ...
Read more >Global Selector - Stylable
In Stylable, selectors are namespaced to the stylesheet. However there might be cases where you want to target global selectors without Stylable namespacing ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Even given the current heuristics i don’t see why it wouldn’t be possible given that
:not(ul)
is equivalent to*:not(ul)
so the selector can be rewritten to& > div:nth-of-type(1) *:not(ul) a
.Indeed I neither can reproduce it with a sandcodebox,
So I guess there’s something obscure with my code (but I’m not crazy, there there’s the screenshot 😬)
Thanks for the fast responses!
*(I used another css to get the job done)