Extend does not assume nested selectors
See original GitHub issueIt seems the feature “Extend” does not assume nested selectors:
This doesn’t work
body {
div { color: red; }
p:extend(div) { background-color: green; }
}
This does work
body {
div { color: red; }
p:extend(body div) { background-color: green; }
}
This also does work
div { color: red; }
p:extend(div) { background-color: green; }
please notice that I had to declare body div
on the second example for the feature to work where it should assume its inheritance automatically and the first example should work without problem, but unfortunately that doesn’t happen.
Issue Analytics
- State:
- Created 10 years ago
- Comments:25 (15 by maintainers)
Top Results From Across the Web
css - Extend function doesn't work with nested selectors
Solution: When using extend feature to extend nested selectors, an exactly matching selector (full selector path) should be provided (or) the ...
Read more >Sass: @extend
Sass knows to extend everywhere the selector is used. ... selectors are interleaved so that they work no matter which order the HTML...
Read more >Lesson 1: Understanding ID and Class in CSS
What if you want to stylize some div elements one way, and other div elements a different way? That's where id and class...
Read more >The Extend Concept | CSS-Tricks
What is notable about LESS extend is that it doesn't extend nested selectors by default. So if we do this: .module { padding:...
Read more >CSS Nesting Is Coming Soon! How To Nest Selector Styles ...
Become A VS Code SuperHero Today: https://vsCodeHero.com Join my Discord developer community: https://discord.gg/A9CnsVzzkZIf ......
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
You need to use the
all
keyword.Right. So, it’s working then. @zanona made the comment that it wasn’t working, so I took that to mean that he was saying it wasn’t supported at all in a @media block and I was confused.