V
V
vasya0922021-07-05 13:47:41
Sass
vasya092, 2021-07-05 13:47:41

Does SCSS or SASS have a selector for classes ending in __container?

There are classes .header__container, .menu__container, .nav__container. Is it possible to somehow use CSS or SASS to make common styles for classes ending in __container without writing them separately.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Recreator, 2021-07-05
@Recreator

what's wrong with just the css selector [class$="__container]?

S
Sergey delphinpro, 2021-07-05
@delphinpro

Alternatively, expand the placeholder:

%container {
  // Общие стили
}

.header__container {
  @extend %container;
}

.menu__container {
  @extend %container;
}

.nav__container {
  @extend %container;
}

But a mix with a separate class is better.container
<div class="nav__container container">
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question