问题:
I feel dumb for having been a web programmer for so long and not knowing the answer to this question, I actually hope it's possible and I just didn't know about rather than what I think is the answer (which is that it's not possible). 我作为一个网络程序员已经这么长时间了,而且不知道这个问题的答案,这让我感到很愚蠢。我实际上希望这是可能的,我只是不知道答案,而不是我认为答案是什么(那是不可能的) 。
My question is whether it is possible to make a CSS class that "inherits" from another CSS class (or more than one). 我的问题是,是否有可能使一个CSS类从另一个CSS类(或多个CSS类)“继承”。
For example, say we had: 例如,假设我们有:
.something { display:inline }
.else { background:red }
What I'd like to do is something like this: 我想做的是这样的:
.composite
{
.something;
.else
}
where the ".composite" class would both display inline and have a red background 其中“ .composite”类将同时显示内联并具有红色背景
解决方案:
参考一: https://stackoom.com/question/4TAR/CSS类可以继承一个或多个其他类吗参考二: https://oldbug.net/q/4TAR/Can-a-CSS-class-inherit-one-or-more-other-classes
来源:oschina
链接:https://my.oschina.net/u/4438370/blog/4335983