Inherit CSS class

后端 未结 9 1216
既然无缘
既然无缘 2020-12-09 07:45

I have one base .base{} in my CSS file with couple properties. I want to change only color and other properties to stay same. How to inherit this base class inother classe

9条回答
  •  伪装坚强ぢ
    2020-12-09 08:15

    You could also use the !important feature of css to make qualities you do not want to override in the original class. I am using this on my site to keep some of the essential characteristics of the original class while overriding others:

    .foo { color: blue; width: 200px !important; } .bar { color: red; width: 400px; }

    This will generate a class "foo bar" element that is red and 200px. This is great if you are using the other two classes individually and just want a piece from each class.

提交回复
热议问题