The title (Heading) is defined by the tags <h1>-<h6>, <h1> defines the largest tag (the most important), and <h6> defines the smallest tag (the least important). It should be noted that the title tag is only used for the title. Do not use the title tag just to produce bold or large text, because the function of the title is to facilitate users to quickly browse the web page, so the title cannot be used indiscriminately. These tags can define the title in the web page (similar to the title in word). Reasonable use of titles can make the hierarchical structure of the web page clearer.
Tip: Headings in HTML help search engines understand the structure and content of a web page.
By default, browsers display content in headings in a larger and bolder font than normal text. Headings defined using the <h1> tag have the largest font size, while headings defined using the <h6> tag have the smallest font size, as shown in the example below. :
<!DOCTYPEhtml><html><head><metacharset=UTF-8><title>HTML title tag demonstration</title></head><body><h1>h1 title</h1><h2>h2 title< /h2><h3>h3 title</h3><h4>h4 title</h4><h5>h5 title</h5><h6>h6 title</h6></body></html>
The running results are shown in the figure below:
1. HTML title
(1) Heading is defined through <h1> - <h6> tags.
(2) <h1> defines the largest title. <h6> defines the smallest heading.
2. Titles are important
Make sure to use HTML title tags only for titles. Don’t use headings just to produce bold or large text.
Search engines use headers to index the structure and content of your web pages.
Because users can use headings to quickly navigate your page, it's 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.
3. HTML horizontal lines
The <hr> tag creates a horizontal line in an HTML page.
The hr element can be used to separate content.
<p>This is a paragraph. </p><hr><p>This is a paragraph. </p><hr><p>This is a paragraph. </p>
The running results are shown in the figure below:
4. HTML comments
Comments can be inserted into HTML code to 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:
<!--This is a comment--><p>The above comment will not be displayed on the web page. </p>
Comment: An exclamation mark! (English punctuation mark) needs to be followed immediately after the opening bracket (the left bracket), but not before the closing bracket (the right bracket). Reasonable use of comments can help with future code editing work.
5. HTML Tips - How to View Source Code
Have you ever looked at some web page and marveled at how it was done?
If you want to find out, just right-click and select View Source (IE) or View Page Source (Firefox), and other browsers do the same thing. Doing so will open a window containing the HTML code for the page.