Issue with background color and Google Chrome

后端 未结 22 1102
一向
一向 2020-12-08 02:06

Sometimes I get a broken background in Chrome. I do not get this error with any other browser.

This is the simple CSS line responsible for the background color of b

22条回答
  •  [愿得一人]
    2020-12-08 02:46

    I had the same issue on a couple of sites and fixed it by moving the background styling from body to html (which I guess is a variation of the body {} to html, body{} technique already mentioned but shows that you can make do with the style on html only), e.g.

    body {
       background-color:#000000;
       background-image:url('images/bg.png');
       background-repeat:repeat-x;
       font-family:Arial,Helvetica,sans-serif;
       font-size:85%;
       color:#cccccc;
    
    }
    

    becomes

    html {
       background-color:#000000;
       background-image:url('images/bg.png');
       background-repeat:repeat-x;
    }
    body {
       font-family:Arial,Helvetica,sans-serif;
       font-size:85%;
       color:#cccccc;
    }
    

    This worked in IE6-8, Chrome 4-5, Safari 4, Opera 10 and Firefox 3.x with no obvious nasty side-effects.

提交回复
热议问题