Background center with chrome (bug)

前端 未结 7 1561
后悔当初
后悔当初 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:37

    For me, this did the trick:

    @media screen and (-webkit-min-device-pixel-ratio:0) { 
    
    html {
        margin-left: 1px;
    }
    
    }
    

    I will post the link for this solution as soon as I find were I got it from a few days ago. In the same post, the guy said the problem was with odd or even number for container width. Anyway, this fixed the problem in my case.

提交回复
热议问题