Background center with chrome (bug)

前端 未结 7 1545
后悔当初
后悔当初 2021-02-06 05:44

I have a background image centered that Chrome displays offset by one pixel.

CSS

#container { 
    background: url(\"images/header.jpg\"         


        
7条回答
  •  無奈伤痛
    2021-02-06 06:24

    I suppose the backgroud image is also 986 pixels wide? Then this effect should also be visible on the left side, turned around though.

    I suggest to remove the background image from the container and add it to the header:

    #container {
        width: 100%;
    }
    #header {
        width: 986px;
        background: url("images/header.jpg") no-repeat scroll 50% transparent;
        margin: 100px auto 0 auto;
    }
    

提交回复
热议问题