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
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>文档标题</title> </head> <body> 文档内容...... </body> </html>
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;<!DOCTYPE HTML>
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.<body> <p>一个段落</p> <img src="img/1.jpg" style="max-width:90%" / alt="What tags must html5 documents have?" ><br><br> <button>一个按钮</button><br><br> <input type="text" value="输入框" /> </body>
Note: Only one
tag can exist in an HTML file. Extended knowledge: Elements that can be included in the head tag##1.
注意,在
在浏览器标题栏或者任务栏中显示标题;
当将页面添加到收藏夹(书签)时提供标题;
在搜索结果中显示页面标题。
下面的示例演示了如何在 HTML 文档中使用
<head> <meta charset="utf-8"> <title>php中文网-教程_手册_视频-免费php在线学习平台</title> </head>
2、
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title><base>标签演示</title> <base href="https://www.php.cn/"> </head> <body> <ul> <li><a href="course.html">视频教程</a></li> <li><a href="course/type/3.html">入门教程</a></li> </ul> </body> </html>
上面的示例中第一个
注意,HTML 文档中的
3、 标签
标签经常用于引用外部 CSS 样式表, 标签中包含两个主要的属性,分别是 rel 和 href。rel 属性用来指示引用文件的类型,href 属性用来设置外部文件的路径。示例代码如下:
<head> <title>此处书写标题</title> <link rel="stylesheet" href="common.css"> </head>
HTML
标签中可以包含任意数量的 标签。4、