所以我正在尝试制作一个 LESS mixin,它需要一个数字(旋转度数)并输出正确的 css 来旋转元素。问题是,我想不出一种方法来为 IE 写“270deg”和“3”(270/90)。以下是我尝试过的事情:
.rotate(@rotation: 0) {
@deg: deg;
-webkit-transform: rotate(@rotation deg); // i can see why this doesn't work
-moz-transform: rotate((@rotation)deg); // parens
-o-transform: rotate(@rotation+deg); // variable-keyword concatenation
transform: rotate(@rotation+@deg); // variable-variable concatenation
// this is the reason I need @rotation to be just a number:
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation/90);
}
.someElement {
.rotate(270)
}
现在我刚刚修改了编译器脚本,以便它不会在变量/关键字连接之间放置空格。我希望有更好的解决方案。