HTML 屬性:content

Baseline 已廣泛支援

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2015 年 7 月⁩以來,各瀏覽器均已提供此特性。

content 屬性指定了 <meta> 元素的 name 屬性所定義的元資料值的內容。它接受一個字串作為其值,並且預期的語法取決於所使用的 name 值。

content 屬性接受的值的型別取決於 name 的值。有關特定格式和型別的詳細資訊,請參閱 <meta> name 屬性頁面。

示例

設定文件的元描述

以下 <meta> 標籤使用 name=description 來為文件設定“元描述”。content 屬性提供了元資料的內容

html
<meta
  name="description"
  content="The HTML reference describes all elements and attributes of HTML, including global attributes that apply to all elements." />

規範

規範
HTML
# attr-meta-content

瀏覽器相容性

另見

  • <meta> name 屬性