h5响应式页面图片处理

浏览器开发者:

<img src="path-to-default-image.jpg" alt="响应式图片的3种解决方案" alt=""
srcset="path-to-default-image.jpg 600w 200h 1x,
path-to-another-image.jpg 600w 200h 2x,
path-to-a-third-image.jpg 200w 200h">

path-to-another-image.jpg 600w 200h 2x

path-to-another-image.jpg 当符合条件时就使用该图片,
依据media queries要求,设备最小尺寸为600w和200h,
浏览器有以2x像素密度显示的能力
这种解决方案兼容性更好

web开发者:

<picture alt="image description">
<source src="/path/to/medium-image.png" alt="响应式图片的3种解决方案" media="(min-width: 600px)">
<source src="/path/to/large-image.png" alt="响应式图片的3种解决方案" media="(min-width: 800px)">
<img src="/path/to/mobile-image.png" alt="响应式图片的3种解决方案" alt="image description">
</picture>

第三张为默认图片源,一二张是在特定媒体查询条件下显示的图片