HTML title

May 02, 2021 11:06 HTML

Table of contents

HTML title

In HTML documents, the title is important.

HTML titles can be used to render document structures, and well-set titles help users navigate your web pages.

HTML title

The title (Heading) is defined by the hashtags

Define the largest title. Define the smallest title.







Try it out . . .

Note: The browser automatically adds empty lines before and after the title.

Note: By default, HTML automatically adds an extra empty line before and after a block-level element, such as a paragraph, before and after a title element.

The title is important

Make sure that the HTML Title label is used only for titles. Don't use a title just to generate bold or large text.

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

Because users can quickly browse your web pages through a title, it is important to present the document structure with a title.

h1 should be used as the main title (most important), followed by h2 (secondaryly important), followed by h3, and so on.

You can learn to edit the hashtags in the hands-on exercises!

HTML horizontal line

The label creates a horizontal line in the HTML page.

The hr element can be used to separate content, using the horizontal lines generated by the element to visually separate the document into sections.

<p>hr 标签定义水平线:</p>

<hr />


<hr />


<hr />


Try it out . . .

HTML comments

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

HTML comments can be easily used to help web designers remind them of program-related information.

The comments are written as follows:

<!-- 这是一个注释 -->

Try it out . . .

Note: After the opening brackets (the parenthesis on the left) you need to follow an exclamation mark, you don't need to end the parenthesis (the parenthesis on the right), and using the comments reasonably can be helpful for future code editing.

You can learn HTML comment statements in The Practice!

HTML Tip - How to view the source code

Have you ever looked at some web pages and marveled at how it works?

If you want to find the mystery, just right-click and select View Source File (IE) or View Page Source Code, as other browsers do. Doing so opens a window that contains the page's HTML code.

HTML title

An example of this site

How to display the title in an HTML document.

Hide comments
How to insert comments in HTML source code.

How to insert a horizontal line.

HTML tag reference manual

W3CSchool's label reference manual provides more information about these titles and their properties.

You'll learn more about HTML tags and properties in the sections below this tutorial.

标签 描述
<html> 定义 HTML 文档
<body> 定义文档的主体
<h1> - <h6> 定义 HTML 标题
<hr> 定义水平线
<!--...--> 定义注释