AMP

amp-dynamic-css-classes

Description

Adds several dynamic CSS class names onto the <body> element.

 

Required Scripts

<script async custom-element="amp-dynamic-css-classes" src="https://cdn.ampproject.org/v0/amp-dynamic-css-classes-0.1.js"></script>

Behavior

The AMP Dynamic CSS Classes extension adds the following CSS classes onto the <body> element:

amp-referrer-*

One or more referrer classes will be set, one for each level of subdomain specificity. For example, www.google.com will add three classes: amp-referrer-www-google-com, amp-referrer-google-com, and amp-referrer-com.

We currently have a few special cases:

  • When the user came through a Twitter t.co short link, we instead use twitter.com as the referrer.
  • When the string "Pinterest" is present in the User Agent string and there is no referrer, we use www.pinterest.com as the referrer.

amp-viewer

The amp-viewer class will be set if the current document is being displayed inside a Viewer.

需要更多帮助?

您已多次阅读本文档,但它仍未能涵盖您的所有问题?也许其他人也这么觉得:在 Stack Overflow 上与他们联系。

前往 Stack Overflow
发现错误或缺少功能?

AMP 项目强烈鼓励您参与并做出贡献!我们希望您能成为我们开放源代码社区的持续参与者,但我们也欢迎您对所热衷问题做出一次性贡献。

前往 GitHub