How to override the properties of a CSS class using another CSS class

后端 未结 6 861
灰色年华
灰色年华 2020-11-28 02:56

I am fairly new to CSS3 and I want to be able to do the following:

When I add a class into a an element, it overrides the properties of another class used in this sp

6条回答
  •  野性不改
    2020-11-28 03:20

    As an alternative to the important keyword, you could make the selector more specific, for example:

    .left.background-none { background:none; }
    

    (Note: no space between the class names).

    In this case, the rule will apply when both .left and .background-none are listed in the class attribute (regardless of the order or proximity).

提交回复
热议问题