Answer the question
In order to leave comments, you need to log in
Less, is it possible to assign new values to @variables via @media query?
Can I do in less like this
@gap: 30px;
@media only screen and (max-width: 1440px) {
@gap: 40px;
}
Answer the question
In order to leave comments, you need to log in
This article habrahabr.ru/post/130089 seems to use approximately what you need
Well, according to your logic, it turns out that the record should somehow be like this:
@media only screen and (max-width: 1440px) {
40px;
}
.gap(30px){padding:@gap}
@media only screen and (max-width: 1440px) {
.gap(40px); // padding: 40px;
}
.gap(30px){padding:@gap}
@media only screen and (max-width: 1440px) {
.gap; // padding: 30px;
}
@gap: 30px;
@media only screen and (max-width: 1440px) {
padding: (@gap + 10px);
}
The answer is probably late, but I think the rest will be useful!
For those who can only afford to support relatively modern browsers (Chrome 49+, FF 31+, no IE), you can use css variables.
Here is the browser support chart from "Can I Use".
html {
--width-var: 244px;
@media screen and (max-width: 1306px){
--width-var: 144px;
};
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question