有没有办法在 LESS 中使用正则表达式?这是我的代码:
CSS:
@color: red;
body{color:@color;}/*Text is red if LESS is loaded correctly */
span{display:inline-block;position:relative;top:2px;}
.char1{.titel-animation(0s);}
.char2{.titel-animation(0.2s);}
.char3{.titel-animation(0.4s);}
.char4{.titel-animation(0.6s);}
.char5{.titel-animation(0.8s);}
.char6{.titel-animation(1s);}
.titel-animation(@delay){
animation: sitetitel 1s @delay ease 1;
-moz-animation: sitetitel 1s @delay ease 1;
-webkit-animation: sitetitel 1s @delay ease 1;
}
@keyframes sitetitel {
50%{
color:blue;
}
}
@-moz-keyframes sitetitel {
50%{
color:blue;
}
}
@-webkit-keyframes sitetitel {
50%{
color:blue;
}
}
HTML:
<span class="char1">F</span>
<span class="char2">o</span>
<span class="char3">o</span>
<span class="char4">b</span>
<span class="char5">a</span>
<span class="char6">r</span>
演示:http:
//jsfiddle.net/kaEGh/
我想要的是替换
.char1{.titel-animation(0s);}
.char2{.titel-animation(0.2s);}
.char3{.titel-animation(0.4s);}
.char4{.titel-animation(0.6s);}
.char5{.titel-animation(0.8s);}
.char6{.titel-animation(1s);}
通过这样的事情:
.char@number{.titel-animation(((@number-1) *0.2)s);}
如果可能的话