How do I get my @import stylesheet to override the main stylesheet?

后端 未结 5 917
独厮守ぢ
独厮守ぢ 2021-02-05 18:20

I imported another stylesheet using @import in the main style sheet file. I would like the changes I have made in the @import stylesheet to override th

5条回答
  •  走了就别回头了
    2021-02-05 19:08

    If your goal is to override styles by importing another stylesheet, you should use the order of precedence.

    
        Title
        
        
    
    

    Here the style.css is the original and style-override.css would contain your new custom css. These styles will override the styles from style.css. This means you won't need to use !important because the style is overwritten.

    Avoid !important whenever you can.

    To do @import

     
    

    Also as a side note if you would rather remove all styles from the page, use a css reset.

     
    

    Check out a CSS reset at http://meyerweb.com/eric/tools/css/reset/ and add it to reset.css.

提交回复
热议问题