-1

我使用重复模式作为 div 的背景图像:

<div style="width:200px; height:100px; background-image:url('test_pattern.png'); background-repeat:repeat-x;"></div>

test_pattern.png 是 25 像素宽,所以我希望它在 200 像素宽的 div 中重复 8 次。这正是我在 Safari 上得到的。但是,铬重复该图案的次数略多于 8 次。更奇怪的是,当我拍摄 chrome 页面的快照时,原来 div 的宽度是 220 像素,而不是 200!无论如何要在所有浏览器上保持一致?

Safari 和 chrome 渲染:

4

1 回答 1

0

I found the problem. Chrome's webpage was zoomed 110%. By resetting it to 100%, both Safari and Chrome render the div the same way.

What's strange is that when I zoom the Safari webpage, the background pattern continues to repeat exactly 8 times. Chrome doesn't!

于 2017-08-02T21:17:46.217 回答