HTML title


In HTML documents, titles are important.


Heading is defined through the <h1> - <h6> tag .

<h1> Define the largest title. <h6> Defines the smallest heading.

Instance

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文网(php.cn)</title>
</head>
<body>

<h1>这是标题 1</h1>
<h2>这是标题 2</h2>
<h3>这是标题 3</h3>
<h4>这是标题 4</h4>
<h5>这是标题 5</h5>
<h6>这是标题 6</h6>

</body>
</html>

Run Instance»

Click the "Run Instance" button to view the online instance

Note: The browser will automatically add blank lines before and after the title.


Titles are important

Make sure to use the HTML title tag only for titles. Don't use headings just to generate bold or large text.

Search engines use headers to index the structure and content of your web pages.

Because users can quickly navigate your web page through headings, it is important to use headings to present the structure of your document.

H1 should be used as the main heading (the most important), followed by h2 (the next most important), then h3, and so on.


HTML Horizontal Line

The<hr> tag creates a horizontal line in an HTML page. The
hr element can be used to separate content.

Instance

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文网(php.cn)</title>
</head>
<body>
	<p>hr 标签定义水平线:</p>
	<hr />
	<p>这是段落。</p>
	<hr />
	<p>这是段落。</p>
	<hr />
	<p>这是段落。</p>
</body>
</html>

Run Instance»

Click the "Run Instance" button to view the online instance



HTML Comments

Comments can be inserted into HTML code, which can improve its readability and make the code easier to understand. The browser ignores comments and does not display them.

The comments are written as follows:

Instance

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文网(php.cn)</title>
</head>
<body>

<!--这是一个注释,注释在浏览器中不会显示-->

<p>这是一个段落</p>

</body>
</html>

Run Instance»

Click "Run Instance" Button to view online examples

Comments: An exclamation point needs to be followed immediately after the opening bracket (the left bracket), but not before the closing bracket (the right bracket). Use comments reasonably. It can be helpful for future code editing work. .


HTML Tips - How to View Source Code

Have you ever looked at some web page and marveled at how it was implemented?

If you want to find out the secret, just right-click and select "View Source" (IE) or "View Page Source" (Firefox). Other browsers do the same thing. Doing so will open a window containing the HTML code for the page.

Example of this site

Title
How to display a title in an HTML document.

Hide comments
How to insert comments in HTML source code.

Horizontal Line
How to insert a horizontal line.


HTML Tag Reference Manual

W3CSschool's Tag Reference Manual provides more information about these headers and their properties.

You will learn more about HTML tags and attributes in the following chapters of this tutorial.

##<html>Definition HTML documentDefine the body of the document##<h1> - <h6>##<hr><!--...-->
TagDescription
<body>
Define HTML title
Define horizontal line
Definition comments