I want the background picture not to be displayed in the IE. How do I do that?

后端 未结 8 1500
暗喜
暗喜 2020-12-22 05:04

Here\'s the CSS , and I want the background picture not to be displayed in IE . Instead I just want the background color to be displayed. How do I do that?

h         


        
8条回答
  •  我在风中等你
    2020-12-22 05:34

    There is obviously multiple ways to answer this question, some good methods already mentioned. Here is another method that I use most often and it requires less bytes:

    To target only Internet Explorer, put an "*" in front of the code that you want to target for I.E. Using your example above, for the background to not appear in I.E. use the * like so:

        html, body {    
        margin:0;
        padding: 0;    
        background: #a9ac41;
       *background-image: none;  
        background-image: url("background.png");    
        background-repeat: no-repeat;
        background-size: cover;    
        margin:0;
    

    If and when it doesn't work, likely your rules are conflicting. In such cases, use "!important", like so:

        *background-image: none !important;
    

提交回复
热议问题