![]() |
VOOZH | about |
Pure CSS refers to the use of Cascading Style Sheets (CSS) to control the appearance and layout of a web page without relying on any scripting language, such as JavaScript. The use of Pure CSS helps keep web pages lightweight and fast-loading. It can also improve accessibility by allowing users to control the presentation of a page through their browser's stylesheet settings.
What is Google AMP?
Google AMP (Accelerated Mobile Pages) is an open-source framework for creating fast-loading mobile web pages. It was introduced by Google in 2015 with the goal of improving the user experience of the mobile web. AMP pages are built using a subset of HTML, CSS, and JavaScript, and are optimized for speed and performance, resulting in pages that load quickly even on slow network connections.
Why use Google AMP?
Points to remember while using pure CSS with Google AMP
When using Google AMP with pure CSS, there are a number of guidelines and restrictions to keep in mind to ensure the pages are fast, accessible, and AMP-valid. These include:
By following these guidelines, we can create fast-loading, visually appealing pages using pure CSS that meet the requirements of the Google AMP framework and provide a great user experience for mobile users.
NOTE: External CSS is not allowed on AMP pages. Custom CSS if any can be added inside the style tag using the amp-custom attribute. Inline CSS is also allowed. AMP reduces HTTP requests in all possible ways.
Syntax:
<html> <head> <style amp-custom> CSS stylings... </style> <script async src= "https://cdn.ampproject.org/v0.js"> </script> </head> <body> content... </body> </html>
Example 1: This example illustrates a simple google amp HTML file with pure CSS. We have applied all the points mentioned in the above syntax section.
Output:
Example 2: This is another example of using pure CSS with google amp. Here we animated the h3 text to change color using pure CSS.
Output:
References: https://pure-css.github.io/#using-pure-with-google-amp