根据屏幕大小,加载不同大小的图片

<!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- 600px)">
            <source srcset="pic2.png" media="(max- 800px)">
            <img srcset="pic3.png" alt="pic">
        </picture>
</body>
</html>
原文地址:https://www.cnblogs.com/supe/p/7395278.html