I
I
Isaac Clark2015-01-08 16:29:38
Sass
Isaac Clark, 2015-01-08 16:29:38

How to get the parent element using SASS?

Hello, tell me please.
There is a code:

.parent {
        color: red;
    }

<div class="parent">
    <span class="child">Hello World!!!</span>
</div>

Question: how can I use sass to refer EXACTLY to the .child element, take its parent and in the parent EXACTLY for the .child element change the color, for example, to green?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Demyanenko, 2015-01-08
@Dark_Knight

Like this jsfiddle.net/bdz2zyx2 ?
Get .parent .child { }

K
Khangeldy Ilebaev, 2015-01-08
@mahabatuly

Didn't understand the question? Are you talking about the ampersant

.parent {
  & .child {
       color: red;
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question