官术网_书友最值得收藏!

Art-direction and responsive images

Let's get back to the issue with the responsive image in our article page example. The problem is that on wider viewports, the image becomes stretched and pixelated as it is scaled. This is because the intrinsic size of our original image is smaller than the viewport on larger screens.

To get around this, you might decide to use a larger image, so that no matter how big the screen is, the image will never be scaled up. The problem with this approach is that it's not good for performance. In most cases, the user will end up downloading a larger image than is needed. Since images are one of the biggest contributors to the page size, if you have a few images like these, they can add up to poor page-load times.

Luckily, there is an HTML5 feature that AMP supports that offers a way to fix this: the srcset attribute.

主站蜘蛛池模板: 绥宁县| 行唐县| 鄢陵县| 即墨市| 婺源县| 阜阳市| 海伦市| 阜康市| 梧州市| 周宁县| 江城| 卫辉市| 龙门县| 昂仁县| 大丰市| 赫章县| 沿河| 竹北市| 襄垣县| 嫩江县| 高要市| 乐山市| 宾川县| 黄陵县| 隆德县| 新宾| 闻喜县| 昌图县| 东丽区| 昌吉市| 偏关县| 海原县| 常宁市| 阿瓦提县| 正蓝旗| 樟树市| 东乡族自治县| 乌拉特前旗| 大丰市| 寻甸| 永兴县|