for 循环生成
//下面是less官方文档给的循环实例,其实实际上这就是递归调用
.loop(@counter) when (@counter > 0) {
.loop((@counter - 1));
width: (10px + @counter);
}
.img-loop(@n, @i:1) when (@i <= @n) {
&.img-@{i} {
background-image: url('../assets/@{i}.png');
background-size: 100% 100%;
}
.img-loop(@n, (@i + 1));
}
// 使用 .cls{ .img-loop(3) }
less 函数封装
.px2rem(@name, @px) {
@{name}: @px / 64 * 1rem;
}
.bgimg(@url){
background-image: url('~@/assets/@{url}');
background-size: 100%;
}
.home {
font-size: 1vw;
.bgimg('logo.png')
}
ios css
-webkit-overflow-scrolling: touch; // 滚动
-webkit-tap-highlight-color:transparent;
-webkit-text-size-adjust: 100%;