- AMP:Building Accelerated Mobile Pages
- Ruadhan O'Donoghue
- 156字
- 2021-07-08 10:04:06
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.
- C# 7 and .NET Core Cookbook
- Microsoft Dynamics 365 Extensions Cookbook
- 三維圖形化C++趣味編程
- Java面向?qū)ο蟪绦蜷_發(fā)及實(shí)戰(zhàn)
- 精通API架構(gòu):設(shè)計(jì)、運(yùn)維與演進(jìn)
- Building Mapping Applications with QGIS
- Learning Laravel 4 Application Development
- 用戶體驗(yàn)增長(zhǎng):數(shù)字化·智能化·綠色化
- Advanced Oracle PL/SQL Developer's Guide(Second Edition)
- Java語(yǔ)言程序設(shè)計(jì)教程
- Access 2010中文版項(xiàng)目教程
- Django 3.0入門與實(shí)踐
- Oracle數(shù)據(jù)庫(kù)編程經(jīng)典300例
- Machine Learning for Developers
- 貫通Tomcat開發(fā)