是否有可能使一个CSS规则结合两个或更多其他CSS规则?

编程入门 行业动态 更新时间:2024-10-27 19:16:13
本文介绍了是否有可能使一个CSS规则结合两个或更多其他CSS规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

例如:

.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规则?

本文发布于:2023-06-08 03:50:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/576119.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:规则   能使   两个   更多   CSS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!