search

Home  >  Q&A  >  body text

Front-end - How to speed up the loading speed of css background images

In one of my pages, I used several css background settings as images. The images are probably dozens of KB.
Now when I open the webpage for the first time, these places are obviously slow to load. It seems For example, after all the styles are loaded, the pictures are brushed out...
Is there any way to speed up css loading; or in other words, make the loading of these pictures synchronized with the appearance of the page, without leaving some blank space waiting to be loaded!
I use nginx, and have https and http2...
Is there any solution, not necessarily acceleration.

滿天的星座滿天的星座2761 days ago1264

reply all(6)I'll reply

  • ringa_lee

    ringa_lee2017-06-06 18:14:13

    Just be lazy and load decisively, it’s simple and easy to use

    reply
    0
  • 阿神

    阿神2017-06-06 09:56:29

    Preload images and add the loading layer, the performance is slightly reduced, but the experience is much better

    reply
    0
  • 黄舟

    黄舟2017-06-06 09:56:29

    If a page is used in many places, you can first reduce the number of requests, process the image into a sprite image, and then compress the image. In fact, it is still a matter of analyzing the specific problem. It is best to see the more specific code

    reply
    0
  • 習慣沉默

    習慣沉默2017-06-06 09:56:29

    Static resources can be placed on CDN. If the image is large, preloading or lazy loading is recommended. When lazy loading, it is recommended to use css to occupy the space in advance to avoid unnecessary reflow. Another note: If the image is too large, it is not recommended to use a sprite image.

    reply
    0
  • 漂亮男人

    漂亮男人2017-06-06 09:56:29

    1. The laziest method is lazyload

    reply
    0
  • 大家讲道理

    大家讲道理2017-06-06 09:56:29

    First of all, it goes without saying the sprite image. Of course, you also have to look at the size

    Secondly, look at the area where the picture is located. If some pictures are not in the immediate viewing area, you can use lazy loading

    If none of the above conditions are met, you can reduce the image size through image compression

    reply
    0
  • Cancelreply