S
S
szQocks2020-10-26 02:16:53
Sass
szQocks, 2020-10-26 02:16:53

How to nest media in media scss?

There is a mixin:

@mixin m1199 () {
  @media (min-width: 992px) and (max-width: 1199px) {
    @content;
  }
}


if I write for example:
@include m991 {
  .features{
    background: red !important;
  }
}

@include m991 {
  .header{
    background: red !important;
  }
}


That styles are duplicated. I read in the sass documentation that if a media query is nested inside a media query, they will then be combined with an end statement, I'm not catching up. Maybe the end operator needs to be attached somewhere?

I need this so that I don’t write media rules after each style, but simply insert a mixin at the end of all styles of the finished one, for example _header.scss , and write styles there to make everything clear.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question