[HTML5] Lazyload below the fold images and iframes with native browser lazy-loading
In this lesson, you'll learn how to use the loading="lazy"
attribute available on images and iframes to lazily load below the fold images, which saves bandwidth and increases the load time performance of web pages. You'll also learn how to prevent images from lazy loading if necessary, and how to add lazy loading to responsive images as well. Lazy loading is supported in Chrome 76, and will be available in the next version of Edge and has public signals of support from Firefox, and Safari as well.
<!DOCTYPE html> <style> img { border: 1px solid black; display: block; width: 400px; height: 1000px; } </style> <img loading="lazy" src="https://via.placeholder.com/400x1000"/> <img loading="lazy" src="https://via.placeholder.com/400x1001"/> <img loading="lazy" src="https://via.placeholder.com/400x1002"/> <img loading="lazy" src="https://via.placeholder.com/400x1003"/> <picture> <source media="(min-width: 100px)" srcset="https://via.placeholder.com/1200x3000"> <img loading="lazy" src="https://via.placeholder.com/400x1004"/> </picture> <img loading="lazy" srcset="https://via.placeholder.com/400x1005 400w, https://via.placeholder.com/800x2010 800w"/> <iframe loading="lazy" src="http://example.com" width="400" height="400"></iframe>
分类:
HTML 5
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2017-08-11 [D3] Build a Scatter Plot with D3 v4
2017-08-11 [AngularJS] Interpolation fail in IE 11
2017-08-11 [Angular] New async 'as' syntax and ngIf.. else
2016-08-11 [Practical Git] Filter commit history with git log arguments
2014-08-11 [CSS] Collapsing Margins
2014-08-11 [Javascript] Ternary Conditionals
2014-08-11 [Javascript] Prototype, hasOwnProperty(), valueOf() and toString() methods.