Background center with chrome (bug)

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

    Is the image actually 986px? The easiest way I found to fix it is to make sure the width of the image is an even number.

    Another thing you could do is add a 2px buffer (to keep the width an even number) in the background image to account for that shift. It shouldn't shift your image as viewed in the browser as long as you add a px to each side to keep it all even.

提交回复
热议问题