css 使用LESS字符串集属性和内容方法

p8h8hvxi  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(133)

我正在为学习目标设置字符串,并使用content方法来调用和显示这些项。除非我特别声明一个静态字符串,否则content方法不能正常工作。这是内容方法的正确语法吗?

&.toc-section .listitem{
    display:none;
    string-set: cnx-learning-objectives content();
}   

&:after {
    display:block;
    background-color: @green;
    content: cnx-learning-objectives content();
    color: red !important;  
}
mklgxw1f

mklgxw1f1#

如果你试图将listitem的内容设置到after元素中(我认为这就是你想要做的),那么我相信这就是你想要的:

&.toc-section .listitem{
    display:none;
    string-set: cnx-learning-objectives content();
}   

&:after {
    display:block;
    background-color: @green;
    content: string(cnx-learning-objectives);
    color: red !important;  
}

相关问题