重用LESS嵌套样式 [英] Reusing LESS nested styles
本文介绍了重用LESS嵌套样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
比方说,我有一种使用Less定义的样式:
Let's say that I have a style defined using Less:
ul.unstyled,
ol.unstyled {
margin-left: 0;
list-style: none;
}
稍后,我想重新使用 unstyled
类:
Later on, I want to re-use the unstyled
class:
.my-list {
.unstyled;
}
但是,这不起作用,而且我无法弄清楚使其发挥作用的魔力.有什么想法吗?
This doesn't work, however, and I can't figure out the magic to make it work. Any thoughts?
推荐答案
您不能重用任意的类定义,只能重用mixins(以点开头的混合符).在这种情况下,您需要复制它.
You can't re-use arbitrary class definitions, only mixins (those starting with a dot). In this case you'll need to duplicate it.
这篇关于重用LESS嵌套样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文