所属分类:web前端开发
示例 h2>
您可以尝试运行以下代码来实现srcset属性。调整浏览器大小以查看加载的不同图像 -
<!DOCTYPE html> <html> <head> <meta name = "viewport" content="width=device-width, initial-scale = 1.0"> </head> <body> <picture> <source media = "(min-width: 550px)" srcset = "https://img.zzsucai.com/202309/06/8HdGj854241053301.jpg"> <source media = "(min-width: 400px)" srcset = "https://img.zzsucai.com/202309/06/sFQyn413645053313.jpg"> <img src = "https://img.zzsucai.com/202309/06/At3wi747152053318.jpg" alt = "Tutorials Library" style = "width:auto;"> </picture> </body> </html>