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

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.

主站蜘蛛池模板: 防城港市| 通山县| 南康市| 贵溪市| 遂川县| 科尔| 福鼎市| 胶南市| 修文县| 基隆市| 平凉市| 建昌县| 普格县| 鲜城| 和林格尔县| 和硕县| 武隆县| 上虞市| 塘沽区| 阿勒泰市| 樟树市| 同江市| 太康县| 芜湖县| 霍邱县| 平泉县| 马公市| 济南市| 兴隆县| 衡南县| 深水埗区| 汕尾市| 泸定县| 石嘴山市| 长治市| 乾安县| 兴化市| 新乡市| 广德县| 天门市| 手机|