question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extend does not assume nested selectors

See original GitHub issue

It 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:closed
  • Created 10 years ago
  • Comments:25 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
Soviutcommented, Dec 12, 2013

You need to use the all keyword.

p:extend(div all) {
    ...
}
0reactions
matthew-deancommented, Jun 11, 2014

extend does not leave its @media scope

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found