AMP

添加样式

AMP 页面是网页 - 对页面及其元素的任何样式设置都是使用标准 CSS 属性完成的。但是,AMP 要求所有 CSS 都包含在文档头部的自定义 style 标签中,称为 <style amp-custom><style amp-custom> 标签必须放在文档的 <head> 中。如果需要,也可以内联定义样式。尝试将以下样式添加到您的页面

  <style amp-custom>
    h1 {
      margin: 1rem;
    }
     body {
      background-color: blue;
    }
  </style>

AMP 允许几乎所有 CSS,但有一些选择器必须避免使用。 在此处了解有关 AMP 中样式设置的更多信息