Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML title


May 02, 2021 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.

<h1>这是标题1</h1>

<h2>这是标题2</h2>

<h3>这是标题3</h3>

<h4>这是标题4</h4>

<h5>这是标题5</h5>

<h6>这是标题6</h6>


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 />

<p>这是段落。</p>

<hr />

<p>这是段落。</p>

<hr />

<p>这是段落。</p>


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:

<!-- This is a comment -->

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

Title
How to display the title in an HTML document.

Hide comments
How to insert comments in HTML source code.

Horizon
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.

Label describe
<html> Define HTML documentation
<body> Define the main body of the document
<h1> - <h6> Define HTML title
<hr> Define horizontal line
<!--...--> Define comments