您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

如何在HTML中指定在不同情况下使用的图像的URL?

2024/6/24 1:07:36发布25次查看
使用 srcset 属性指定要在 html 中的不同情况下使用的图像的 url。
示例 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://www.tutorialspoint.com/assets/videotutorials/courses/3d_animation_online_training/380_course_211_image.jpg"> <source media = "(min-width: 400px)" srcset = "https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg"> <img src = "https://www.tutorialspoint.com/videotutorials/images/tutorial_library_home.jpg" alt = "tutorials library" style = "width:auto;"> </picture> </body></html>
以上就是如何在html中指定在不同情况下使用的图像的url?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product