O
O
Outsider V.2017-11-04 19:51:11
css
Outsider V., 2017-11-04 19:51:11

Is it possible to place class selectors inside the class selector of the parent?

I write styles in SCSS. There is, for example, a .catalogue__materials-sorter material sorter with .catalogue__materials-sorter__option buttons inside it (in HTML). I write:

.catalogue__materials-sorter {
  //...

  .catalogue__materials-sorter__option {
    //...
  }
}

In this case, the button blocks cannot be used in any other place except inside the sorter, and it’s more convenient for me to write in the IDE in this way - in a cascade, so that it’s clear what goes where and can be collapsed.
Is this welcome? Or then already remove the classes from the buttons and select them simply as a > div inside the parent?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Froggyweb, 2017-11-04
@Audiophile

You can write &__option
, and you will like it and the styles will be right

A
Andrew, 2017-11-04
@daaner

> div is not needed, you have BEM, as it were.
Via & normal theme. Moreover, then you will collect everything as it should

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question