Min's blog

I choose to see the beauties in the world.

导航

响应式图片

Posted on 2017-08-28 09:34  Min77  阅读(112)  评论(0编辑  收藏  举报

1.picture

<picture>
    <source media="(max-width:36em)" srcset="img/ad001.png 480w" type="image/svg+xml"/>
    <source media="(max-width:50em)" srcset="img/ad001-m.png 800w" type="image/webp"/>
    <source srcset="img/ad001-l.png 1600w"/>
    <img src="img/ad001.png" alt="">
</picture>

2.srcset

  <img src="img/ad002.png" srcset="img/ad002.png 480w,img/ad002-m.png 800w,img/ad002-l.png 1600w" alt="" sizes="(max-width:800px) 800px,100vw">

  

3. js

 

4.svg