假设我有一些像这样的 less 代码:
@desktop-min-width: 1024px;
@phone-max-width: 768px;
@desktop: ~"only screen and (min-width: @{desktop-min-width})";
@tablet: ~"only screen and (min-width: @{phone-max-width}) and (max-width: @{desktop-min-width})";
@phone: ~"only screen and (max-width: @{phone-max-width})";
.hola {
@phone {
height: 100vh;
top: 10px;
}
@tablet {
height: 30vh;
top: 30%;
}
@desktop {
height: 30vh;
top: 30%;
}
}
// ...more styles...
我有办法结合@tablet 和@desktop 并减少重复吗?我想象的是这样的:
@tablet or @desktop {
height: 30vh;
top: 30%;
}
最佳答案
只需使用逗号即可完成您想要的操作:
@tablet, @desktop {
...
}
关于css - 如何将这两个 Less @Media 查询与 "Or"条件结合起来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53210654/