Home>Article>Web Front-end> What tags must html5 documents have?
There must be 4 tags: 1. "", which is a document type declaration of a standard universal markup language; 2. "", which is used to inform the browser of its Itself is an HTML document; 3. "
" contains the metadata of the document; 4. "" is used to contain content that visitors can see.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
html5 document must have 4 tags
This HTML document describes a blank page. These basic components determine the outline of the HTML document. and the browser's initial environment.文档标题 文档内容......
1. tag
DOCTYPE is the abbreviation of document type.
The doctype declaration is a document type declaration in a standard universal markup language. It is used in web design to indicate what version of XHTML or HTML you are using. It tells the browser two things: It processes HTML documents;tag is the outermost element in an HTML document. The
tag is a container for all other HTML elements (except the tag). The function of the root element is to tell the browser that the content between and is of HTML type, and the browser will parse the content as HTML. The html element has three attributes, namely the lang attribute, the xmlns attribute and the manifest attribute: The lang attribute specifies the default language used for page content. Specifying the language in which the document is written helps a language synthesis tool choose a pronunciation language, or a translation tool choose translation rules. For example, means that this document is in Chinese.tag is a container for all head tags. These head tags are used to Defining metadata about the HTML document (data that describes the data) and references to the required resources (such as CSS style files, JavaScript script files) play a very important role in enabling the document to be displayed correctly in the browser.
According to our needs, we can define a large amount of metadata in the HTML header, or we can define little or no metadata at all. Although the head tag is part of the HTML document, its content is not displayed in the browser.4. The
tagelement defines the body of the document. The
element contains all the content of the document, such as text, hyperlinks, images, tables, lists, etc. Simply put: the body part of the document contains the content that visitors can see. After having this basic structure, we can gradually add other elements of HTML later, continuously enrich the document, and finally get the page we want.一个段落
Note: Only one
tag can exist in an HTML file. Extended knowledge: Elements that can be included in the head tag##1.
注意,在
在浏览器标题栏或者任务栏中显示标题;
当将页面添加到收藏夹(书签)时提供标题;
在搜索结果中显示页面标题。
下面的示例演示了如何在 HTML 文档中使用
php中文网-教程_手册_视频-免费php在线学习平台
2、
标签演示
上面的示例中第一个
注意,HTML 文档中的
3、 标签
标签经常用于引用外部 CSS 样式表, 标签中包含两个主要的属性,分别是 rel 和 href。rel 属性用来指示引用文件的类型,href 属性用来设置外部文件的路径。示例代码如下:
此处书写标题
HTML
标签中可以包含任意数量的 标签。4、
使用
此处书写标题
注意:对于文档中的唯一样式可以使用
5、 标签
标签用于提供有关 HTML 文档的元数据,例如页面有效期、页面作者、关键字列表、页面描述等信息。 标签定义的数据并不会显示在页面上,但却会被浏览器解析。
1) 定义字符集
charset 属性用来指定 HTML 文档的字符编码,上面的示例中,我们将文档的字符编码设置为了“UTF-8”。
2) 定义页面描述
定义页面的描述信息有利于搜索引擎的搜索。
标签定义文档标题,name="description" 定义文档描述,描述的长度通常大于标题。 3) 定义关键字
关键字用于为搜索引擎提供与页面有关的信息。
4) 定义页面作者
通过某些内容管理系统可以自动提取作者信息。
5) 刷新页面
上例中的代码用于向浏览器发送一个指令,使浏览器在经过指定的时间间隔(30 秒)后自动刷新页面。在 content 属性中除了可以指定时间间隔外,还可以再指定一个链接,这时页面将在指定的时间后重定向到链接所指向的页面,如下例所示:
6、
PHP中文网 7、
当用户的浏览器不支持 JavaScript 脚本或者禁用 JavaScript 脚本时,可以在
The above is the detailed content of What tags must html5 documents have?. For more information, please follow other related articles on the PHP Chinese website!