Head元素

2022-04-21
1分钟阅读时长

元数据<title>元素

用于表示HMTL文档的标题,放在<head></head>之间。在对页面添加书签时, <title> 的内容被作为建议的书签名。

元数据<meta>元素

文档编码

<meta charset="utf-8">

这个元素指定了文档的字符编码为UTF-8

作者与描述

<meta> 元素包含了namecontent 特性:

  • name 指定了meta 元素的类型; 说明该元素包含了什么类型的信息。
  • content 指定了实际的元数据内容。

除以上种类外,还有着一些其他类型的元数据,一般专用于个别网站。

如:

<meta name="author" content="Chris Mills">
<meta name="description" content="The MDN Learning Area aims to provide
complete beginners to the Web with all they need to know to get
started with developing web sites and applications.">

设置文档主语言

通过添加lang属性到HTML开始标签中来实现设置文档主语言。

<html lang="zh-CN">