How we could load lazy Background image? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 5

How we could load lazy Background image?

There is a css property which all new version of browser supports for img lazy loading that is loading with lazy value on image tags. But is there any css solution for background-iamg lazy loading? šŸ‘ˆšŸ§ I know that there is some packages for that and interestion observer API is another solution but it's hard to Implement.

23rd Apr 2023, 9:51 AM
Yasin Rahnaward
Yasin Rahnaward - avatar
9 Respostas
+ 5
So google was wrong??! Disgusting šŸ˜ could be, day by day technologies gets updates and a simple & fast to code solution is better then copy- past & older solution.
23rd Apr 2023, 10:53 AM
Yasin Rahnaward
Yasin Rahnaward - avatar
+ 2
Ugulberto SƔnchez I know the intersection API can handle it, but my question is specifically about a css solution for background-image lazy loading, which we have a css solution for lazy load on <img/> tag that all new version browsers support it.
23rd Apr 2023, 10:19 AM
Yasin Rahnaward
Yasin Rahnaward - avatar
+ 2
Thanks but I am comfortable with css so if there is no solution for it, I will replace all background-image with img tags
23rd Apr 2023, 10:38 AM
Yasin Rahnaward
Yasin Rahnaward - avatar
+ 1
There is no solution for css only loading background images, i searched it on google. You can use also js to do thatā€¦
23rd Apr 2023, 10:35 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 1
So google was wrong??! Disgusting šŸ˜
23rd Apr 2023, 10:39 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 1
Completely true. Sorry that I was wrong šŸ˜”
23rd Apr 2023, 10:55 AM
Ugulberto SƔnchez
Ugulberto SƔnchez - avatar
+ 1
Use the WebP format: The WebP image format may be faster to load than other formats, such as JPEG or PNG. You can use online tools to convert your images to the WebP format or load the image on a CDN
23rd Apr 2023, 10:52 PM
Beldavisss šŸ‘¾
Beldavisss šŸ‘¾ - avatar
27th Apr 2023, 7:12 PM
Cezary