Answer the question
In order to leave comments, you need to log in
Less CSS - How to Stop Writing Responsive Design Rules Twice?
Now in Less CSS I have to write the code twice, which is frustrating:
// правила для малых экранов
div {
margin: 10px;
}
@media (min-width : 400px) {
// правила для широких экранов
div {
margin: 20px;
}
}
// правило описывается однажды
div {
margin: @margin;
}
@margin: 10px;
@media (min-width : 400px) {
@margin: 20px;
}
Answer the question
In order to leave comments, you need to log in
Haven't used Less in a while, but Sass allows you to write like this:
div {
margin: 10px;
@media (min-width : 400px) {
margin: 20px;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question