我的这个少了,我不知道如何在字符串内进行数学运算
@bp-tablet-landscape: 1024px;
@bp-tablet-portrait : 768px;
@tablet-landscape-only: ~"only screen and
(min-width:@{bp-tablet-portrait} + 1) and (max-width: @{bp-tablet-landscape})";
Usage
div#header {
@media @tablet-landscape-only {
background: #000;
}
}
但它并不能完全正确编译。它没有像我希望的那样添加 768px + 1 。有任何想法吗?我尝试过几种不同的口味,但我无法确定。显然,我可以在字符串连接之外定义一个变量,但如果可能的话,我想避免这种方法。
winLess在线编译器 outputs
@media only screen and (min-width:768px + 1) and (max-width: 1024px) {
div#header {
background: #000;
}
}
我想要得到769px
在那里而不是768px + 1
不在字符串本身内,但是......
如果将其从字符串中分离出来,则在后面进行第二次插值(注意第二个~
),这有效:
@tablet-landscape-only: ~"only screen and (min-width: "(@bp-tablet-portrait + 1) ~") and (max-width: @{bp-tablet-landscape})";
为了产生这个:
@media only screen and (min-width: 769px ) and (max-width: 1024px) {
div#header {
background: #000;
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)