在CSS中将ID与类别相关联 [英] Associate ID with Class in CSS
本文介绍了在CSS中将ID与类别相关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以在CSS中做些聪明的事情来指示具有特定ID的元素应始终使用一个或多个类吗?像这样:
Is there something clever I can do in CSS to indicate that an element with a particular ID should always use one or more classes? Something like:
#user_info_box {
use-class: ui-widget-content ui-corner-all;
position: fixed;
left: 10px;
...
}
只有您知道,使用的是实际有效的CSS属性.
Only, you know, using actual valid CSS properties.
推荐答案
LESS 非常适合.具体来说,请参见"mixins".
LESS is perfect for this. Specifically, see "mixins".
#user_info_box {
.ui-widget-content;
.ui-corner-all;
position: fixed;
left: 10px;
...
}
这篇关于在CSS中将ID与类别相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文