V
V
Vadim Stepanenko2021-06-22 16:53:59
Sass
Vadim Stepanenko, 2021-06-22 16:53:59

Import scss and use styles only if element is in parent?

Hey!
styles are written according to BEM, each block has its own scss file.

there is a sidebar from the ui library, with its own styles.
if the sidebar is a child of the .dashboard container, you need to overwrite some styles, if it is not a child, then we leave the styles from the ui kit.

there is a sidebar.scss file:

.sidebar {
     &__inner {
          ...

          &:hover {
               ...
          }
     }
     ...etc
}


and there are styles for the dashboard:
.dashboard {
     ...
}


you need to somehow import .sidebar into .dashboard so that the styles from the sidebar are applied only to descendants of the dashboard. this can be done?

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