如何将这两个 Less @Media 查询与 "Or" 条件结合起来?
How To Combine These Two Less @Media Queries With An "Or" Condition?
假设我有一些像这样的 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 {
...
}
假设我有一些像这样的 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 {
...
}