Placeholder background/image while waiting for full image to load?

前端 未结 11 1630
栀梦
栀梦 2020-12-13 03:36

I have a few images on my page. I\'m finding that the page starts to render before the images have been loading (which is good), but that the visual effect is not great. Ini

11条回答
  •  半阙折子戏
    2020-12-13 04:27

    Here's one naive way of doing it,

    img { box-shadow: 0 0 10px 0 rgba(#000, 0.1); }

    You can manipulate the values, but what it does is it creates a very light border around the image that doesn't push the contents. Images can load at whatever time they want, and you get a good user experience.

    Hope that it helps

提交回复
热议问题