简体   繁体   English

CSS LESS输出问题

[英]CSS LESS Output Issue

CSS/Less Input: CSS / Less输入:

.generate-tiles(12);

.generate-tiles(@n, @i: 1) when (@i =< @n) {
  .generate-tiles(@n, (@i + 1));
  .tile-@{i} {
    transform: rotateX(60deg) rotateZ(45deg) translate3d(((@i - 1) * 45)px, 0px, 0px);
  }
}

Output: 输出:

.tile-1 {
  transform: rotateX(60deg) rotateZ(45deg) translate3d(0 px, 0px, 0px);
}

The function works perfect, but I can't figure out why it's creating a space between the # and px as seen here: 该函数运行完美,但是我无法弄清楚为什么它在#px之间创建了空格,如下所示:

(495 px, 0px, 0px);

If you calculate the value in a variable and then insert the variable in an escaped string, it outputs without the space: 如果您在变量中计算值,然后将变量插入转义的字符串中,则输出时将不带空格:

@t: (@i - 1) * 45;
transform: rotateX(60deg) rotateZ(45deg) translate3d(~'@{t}px', 0px, 0px);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM