LessCss选择器插值与父引用



我有一个问题,我想使用所有类型的输入,如数字、url、电子邮件。。。所以所有的样式都是普通文本。。。我经常在文件中使用它们,所以我想创建一个
selector interpolation对此进行管理:

@inputs: ~"input[type=number],  input[type=url], input[type=email], input[type=date], input[type=password], input[type=text]";

这很好用,直到我想把它们放进嵌套。。。

所以。。

#content {
    @{inputs} {width: 20%}  
}

将输出:

#content input[type=number], input[type=url], ... {width: 20%}

但我需要这个:

#content input[type=number], #content input[type=url], ... {width: 20%}

有人有主意吗?

我终于找到了解决方案:)
我更改了字符串插值器:

@inputs: ~"input[type=number],  input[type=url], input[type=email], input[type=date], input[type=password], input[type=text]";

至:

@inputs: ~"input[type=number]," + " &" ~"input[type=url]," + " &" ~"input[type=email]," + " &" ~"input[type=date]," + " &" ~"input[type=password]," + " &" ~"input[type=text]";

更新:

此解决方案仅适用于此编译器:leapo.net/lessphp

最新更新