background preloader

Accelerated Mobile Pages Project – AMP

Facebook Twitter

What Google AMP means for the JavaScript community · molily. Webdesign.tutsplus. Who-needs-amp-how-to-lazy-load-responsive-images-quick-and-easy-with-layzr. AMP Project: Will it Make Your Sites Faster? As of February 24th, Google search results have started including links to versions of mobile pages created using Accelerated Mobile Pages, aka “AMP”, an open source project it has backed.

AMP Project: Will it Make Your Sites Faster?

AMP has the goal of making mobile sites load faster and providing a better experience for users. Google and the AMP Project are making a big push to get AMP adopted across the web, and they’re already doing well. Automattic is adding AMP support to, Pinterest is AMPing itself up, Twitter has pledged support as have Chartbeat,, Adobe Analytics & LinkedIn, and we’re seeing AMP versions come into the mix for the popular sites Wall Street Journal, Buzzfeed, The Guardian, BBC News, The New York Times and several others.

The reason all these companies are getting on board is simple: load speed. There’s no debating that faster sites are better, so in this article I won’t be preaching to the choir by going into all the reasons why that’s the case. The⚡ Highlighting in Search Results. Quick Tip: Make AMP’s Inline CSS Easier With Jade or PHP. Validator.ampproject. Supported CSS. Like all web pages, AMP pages are styled with CSS, but you can’t reference external stylesheets (with the exception of custom fonts) and inline style attributes aren’t allowed.

Supported CSS

Also, certain style properties related to animations have been disallowed due to performance implications, and the embedded style tag must be in the <head> of the page. These different kinds of limitations are there to improve the performance of your pages, but can be overwhelming at first. When in doubt, always test your styles using the AMP validator. Even though inline stylesheets add bytes to every page, the saved round trip request to another external file would be even slower. Having your styles in the <head> of the page effectively means that all your CSS becomes critical CSS that is loaded before the rest of the page is loaded, so only include what you need.

Read on to learn how to style your AMP pages: Learn more about critical CSS in this article, Understanding Critical CSS. Add styles to a page. Style & layout. Styling and layout on AMP HTML pages is very similar to normal HTML pages – in both cases, you'll use CSS.

Style & layout

However, AMP limits some use of CSS for performance and usability reasons, while expanding responsive design capabilities with features like placeholders & fallbacks, advanced art direction via srcset and the layout attribute for better control over how your elements display. Add styles to a page Add all CSS inside a <style amp-custom> tag in the head of the document.

For example: Define component styles with class or element selectors using common CSS properties. <body><p>Hello, Kitty. Layout elements responsively Specify the size and position for all visible AMP elements by providing a width and height attribute. Set the layout to responsive. Provide placeholders & fallbacks The built-in support for placeholders and fallbacks means your users never have to stare at a blank screen again. Art direct your images Validate your styles and layout. Quick Tip: Make AMP’s Inline CSS Easier With Jade or PHP.   Google Developers.   Google Developers. Accelerated Mobile Pages Project. Up and Running With AMP - CSS and AMP. Accelerated Mobile Pages Project – AMP.