Answer the question
In order to leave comments, you need to log in
How to change the value of a variable from another file?
I made the landing page, it remains to make media queries. Created variables with font sizes in variables.scss ($font-h1). In the file media.scss I tried to change the value of $font-h1 - nothing has changed.
The structure is the following. There is a style.scss in it:
@import "variables.scss";
// между ними еще несколько файлов (header.scss, footer.scss и т.д.)
@import "media.scss";
Answer the question
In order to leave comments, you need to log in
What have you tried?
Like this:
$h1: 30px;
h1 { font-size: $h1; }
@media(){
$h1: 20px;
}
$h1: 30px;
$h1-sm: 20px;
h1 { font-size: $h1; }
@media(){
h1 { font-size: $h1-sm; }
}
:root {
--h1: 30px;
}
h1 { font-size: var(--h1, 30px); }
@media(){
:root {
--h1: 20px;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question