例如:
.strong { font-weight: bold; } .italicized { font-style: italic; } .strong_and_italicized { .strong; .italicized; }我问,因为我正在处理一些jQuery操作一些DOM对象已经从jquery ui主题css文件分配了多个不同的类。在我看来,将多个类组合成一个类会更容易,然后我可以在尝试选择DOM对象时在JavaScript代码中引用该类。
I ask because I'm working on some jquery that is manipulating some DOM objects that have been assigned multiple different classes from the jquery ui theme css file. It seems to me it would be much easier to combine the multiple classes into one class and then I could just refer to that class in the javascript code when trying to select the DOM object.
推荐答案将CSS类合并成一个类似于我知道的唯一方法是使用一个CSS预处理器,如 LESS 或 SASS 。
The only way to combine CSS classes into one like that, that I know of, is to use a CSS pre-processor like LESS or SASS.
如果您不想使用它,恐怕你必须分别分配这两个类。
If you don't want to use that, I'm afraid you have to assign both classes separately.
更多推荐
是否有可能使一个CSS规则结合两个或更多其他CSS规则?
发布评论