Can a CSS class inherit one or more other classes?

前端 未结 30 3698
挽巷
挽巷 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:44

    That's not possible in CSS.

    The only thing supported in CSS is being more specific than another rule:

    span { display:inline }
    span.myclass { background: red }
    

    A span with class "myclass" will have both properties.

    Another way is by specifying two classes:

    ...

    The style of "else" will override (or add) the style of "something"

提交回复
热议问题