Loading CSS background images before normal images?

后端 未结 4 684
抹茶落季
抹茶落季 2021-01-14 09:58

I have a ruby on rails web app, and in some views i have many heavy images( ) to render .The are generated in a Helper.

4条回答
  •  萌比男神i
    2021-01-14 10:42

    Use a base64 string.

    Example:

    background-image: url(data:image/png;base64,*CONVERTED IMAGE DATA HERE*);
    
    • without: **
    • online converter: http://webcodertools.com/imagetobase64converter
    • note: I only would suggest this if the image size is not too heavy.

提交回复
热议问题