Can a CSS class inherit one or more other classes?

前端 未结 30 3979
挽巷
挽巷 2020-11-22 00:01

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 tha

30条回答
  •  庸人自扰
    2020-11-22 00:38

    As others have said, you can add multiple classes to an element.

    But that's not really the point. I get your question about inheritance. The real point is that inheritance in CSS is done not through classes, but through element hierarchies. So to model inherited traits you need to apply them to different levels of elements in the DOM.

提交回复
热议问题