AMP

新增樣式

AMP 網頁就是一般的網頁 — 任何對網頁及其元素的樣式設定,都是使用標準的 CSS 屬性來完成。然而,AMP 要求所有 CSS 都必須包含在文件 head 中的一個自訂 style 標籤內,稱為 <style amp-custom><style amp-custom> 標籤必須位於文件的 <head> 內。如果需要,也可以內嵌定義樣式。嘗試將以下樣式新增到您的網頁中

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

AMP 允許幾乎所有的 CSS,但有一些選擇器必須避免使用。在此處瞭解更多關於 AMP 樣式設定的資訊