N
N
noteblock2016-10-14 16:40:50
Sass
noteblock, 2016-10-14 16:40:50

How are exceptions written in SASS/SCSS?

Didn't find the answer in the documentation.
Is there any special character or something like nesting to write a property for an element that is not nested in the parent?
Something along the lines of:

& > div > .form-item > label, (magic_symbol) .not_child_element{
…
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Bobylev, 2016-10-14
@dpigo

Nesting is designed to describe child elements depending on the parent. If you need to reuse part of a style, use placeholders and @extend :

%shared{
 ...
}

.parent {
  & > div > .form-item > label {
    @extend %shared;
  }
}

.not_child_element {
  @extend %shared;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question