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

后端 未结 6 852
灰色年华
灰色年华 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:11

    LIFO is the way browser parses CSS properties..If you are using Sass declare a variable called as

    "$header-background: red;"

    use it instead of directly assigning values like red or blue. When you want to override just reassign the value to

    "$header-background:blue"

    then

    background-color:$header-background;

    it should smoothly override. Using "!important" is not always the right choice..Its just a hotfix

提交回复
热议问题