我想用less来定位类中的特定元素。
在这种情况下,我想要定位类的元素 button
,但在其中我想要定位锚标签 a
。
目前我有:
.button {
/* lots of bits and pieces go here, hence
the need to keep it at a class level
*/
/* further down, but still in .button */
/* Attempt 1 - fails: compiled = a .button (note the space)
a& {
height:20px;
}
/* Attempt 2 - fails: compiled = .buttona
&a {
height:20px;
}
}
我基本上希望它编译为:
a.button
这样我就可以创建如下元素:
<a class="button">
<button class="button">
但是当它成为一个锚时稍微改变它。我不想扔进去 it's a bug in less!
卡太早,但如果我使用 &.another-class
它按预期工作(编译: .button.another-class
,但不是在定位元素时