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

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.

主站蜘蛛池模板: 花莲县| 罗江县| 互助| 墨江| 阜新| 沂源县| 陵川县| 会理县| 洪洞县| 华坪县| 隆德县| 错那县| 拜泉县| 高雄市| 普宁市| 牙克石市| 德保县| 通道| 左云县| 宿迁市| 合山市| 遵义县| 家居| 杭锦旗| 临安市| 定陶县| 汝阳县| 新丰县| 白玉县| 彭州市| 抚州市| 武功县| 江孜县| 洪湖市| 扶余县| 红桥区| 凤翔县| 郯城县| 兖州市| 集贤县| 涟水县|