Sass: Absolute links inside nested selectors

In Sass, is there any way to use root / top-level selectors inside a nested element? That would be helpful.

For example, I want to define the same style for all tags aat the root level and tags lionly inside ul. Here's an imaginary example where it /does the following:

ul {
    li, /a {
       color:black;
    }
}

The presented stylesheet will look like this:

a {
    color: black;
}

ul li {
    color: black;
}
+3
source share
2 answers

You can use selective inheritance with @extend. NTN.

0
source

This file.scss

ul {
  li,
  li a {
    color:black
  }
}

Compiles this

ul li,
ul li a {
  color: black;
}

Isn't that what you wanted?


UPDATE: What you are trying to achieve is possible with @extend

0
source

All Articles