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 属性