Css 如何将这两个Less@Media查询与一个;或;条件
假设我的代码更少,如下所示:Css 如何将这两个Less@Media查询与一个;或;条件,css,sass,responsive-design,less,media-queries,Css,Sass,Responsive Design,Less,Media Queries,假设我的代码更少,如下所示: @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: @{des
@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 {
...
}
只需使用逗号就可以实现您想要的功能:
@tablet, @desktop {
...
}