根据屏幕大小,加载不同大小的图片
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Document</title> <script> document.createElement( "picture" ); </script> </head> <body> <picture> <source srcset="pic1.png" media="(max-width: 600px)"> <source srcset="pic2.png" media="(max-width: 800px)"> <img srcset="pic3.png" alt="pic"> </picture> </body> </html>