Repeating website background image - size vs speed

前端 未结 7 1528
滥情空心
滥情空心 2020-12-09 08:57

I was wondering if anyone has done any tests with background images. We normally create a background that repeats at least in one direction (x or y or both).

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 09:15

    I found out that there may be a huge difference in the rendering performance of the browser, if you have a background-image with width of 1px and repeating it. It's better to have a background-image with slightly larger dimensions. So a image with a width of 100px performs much better in the browser. This especially comes into play when you use a repeated background-image in a draggable layer on your website. The drag-performance is pretty bad with an often-repeated background-image.

提交回复
热议问题