Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
AMP: Building Accelerated Mobile Pages

You're reading from   AMP: Building Accelerated Mobile Pages Create lightning-fast mobile pages by leveraging AMP technology

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781786467317
Length 370 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
 O'Donoghue O'Donoghue
Author Profile Icon O'Donoghue
O'Donoghue
Arrow right icon
View More author details
Toc

Table of Contents (24) Chapters Close

Title Page
Credits
About the Author
Acknowledgements
About the Reviewer
www.Packtpub.com
Customer Feedback
Preface
1. Ride the Lightning with AMP FREE CHAPTER 2. Building Your First AMP Page 3. Making an Impression - Layout and Page Design in AMP 4. Engaging Users with Interactive AMP Components 5. Building Rich Media Pages in AMP 6. Making Contact - Forms in AMP 7. Dynamic Content and Data-Driven Interaction 8. Programming in AMP - amp-bind 9. When AMP Is Not Enough - Enter the iframe 10. Ads and Analytics in AMP 11. AMP Deployment and Your Web Presence 12. AMP - Where It's At and Where It's Going 13. AMP Components 14. Actions and Events 15. amp-bind Whitelisted Functions 16. amp-bind Permitted Attribute Bindings

Using custom CSS in AMP pages


We have seen that CSS is a key part of layout and design in AMP, as it is in HTML. In fact, AMP components come with built-in, default styles that are defined in a CSS file, amp.css, that's automatically included by the AMP library. For custom CSS styling in your AMP pages, there are restrictions on what you can do. You should already know that:

  • All styles must be defined in the <head> of the document; no in-line styles
  • A maximum of 50 KB of CSS is permitted
  • External stylesheets can't be used

There are also some further restrictions you should be aware of:

Style

Restriction

Description

!important qualifier

Not allowed

Allows AMP to enforce its styling rules

Class and tag names that start with -amp- and i-amp-

Not allowed

User stylesheets cannot define or reference CSS selectors for these classes and tags

behavior, -moz-binding

Not allowed

Security restriction

filter

Not allowed

Performance restriction

transition

Restricted

Only GPU-accelerated properties allowed: opacity, transform...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images