Answer the question
In order to leave comments, you need to log in
Is it possible in scss to apply styles depending on the parent attribute?
Hey! My site theme (dark/light) is set in the attribute of the body tag theme="light/dark".
scss has this construct for media queries:
.element {
...
@ media screen and (min-width: 544px) {
// стили для экрана от 544 пкс
}
}
.element {
color: var(--color);
@ body[theme="dark"] {
--color: white;
}
@ body[theme="light"] {
--color: #333333;
}
}
Answer the question
In order to leave comments, you need to log in
So write it down
.element {
color: var(--color);
body[theme="dark"] & {
--color: white;
}
body[theme="light"] & {
--color: #333333;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question