这是我的Less代码:
i.icon-gps {
.sprite(@icon-gps);
display:inline-block;
}
i.icon-home {
.sprite(@icon-home);
display:inline-block;
}
i.icon-map {
.sprite(@icon-map);
display:inline-block;
}
//and many more
是否可以将其写入一个表达式?
答案 0 :(得分:2)
如果用量为<i class="icon-gps" ></i>
i.icon
{
&-gps {
.sprite(@icon-gps);
display:inline-block;
}
&-home {
.sprite(@icon-home);
display:inline-block;
}
&-map {
.sprite(@icon-map);
display:inline-block;
}
}
如果用量为<i class="icon icon-gps"></i>
(感谢@ Curt&#39>
i.icon
{
display:inline-block;
&-gps {
.sprite(@icon-gps);
}
&-home {
.sprite(@icon-home);
}
&-map {
.sprite(@icon-map);
}
}