我正在设置学习目标的字符串,并使用内容方法来调用和显示这些元素。除非我专门声明静态字符串,否则内容方法无法正常工作。这是内容方法的正确语法吗?
&.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;
}
最佳答案
如果您尝试将 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;
}
关于css - 使用 LESS 字符串集属性和内容方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11764700/