Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML heading

HTML heading


In an HTML document, headings are very important.


HTML heading

Headings are defined through the

-

tag.

defines the largest heading.

defines the smallest heading.

Example

<

h1

This is a heading.

h1

<

h2

This is a heading.

h2

<

h3

This is a heading.

h3

Try it »

Note: Browsers automatically add blank lines before and after headings.


Headings are important

Please ensure that HTML heading tags are used only for headings. Do not use them merely to produceBoldorlarge-sizedtext by using headings.

Search engines use headings to index the structure and content of your web page.

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

You should use h1 for the main heading (the most important), followed by h2 (the second most important), then h3, and so on.


HTML Horizontal Lines


The tag creates a horizontal line in an HTML page.

The hr element can be used to separate content.

Example

<

p

This is a paragraph.

p

<

hr

<

p

This is a paragraph.

p

<

hr

<

p

This is a paragraph.

p

Try it »


HTML Comments

Comments can be inserted into HTML code to improve readability and make the code easier to understand. Browsers ignore comments and do not display them.

Comments are written as follows:

Example

Try it »

Note: After the opening bracket (the left bracket), an exclamation mark ! (English punctuation) must follow immediately; before the closing bracket (the right bracket), it is not needed. Proper use of comments can help with future code editing work.


HTML Tip - How to View the Source Code

Have you ever looked at a web page and marveled at how it was created?

If you want to discover the secret, simply right-click and select "View Source" (IE) or "View Page Source" (Firefox); other browsers work in a similar way. This will open a window containing the page's HTML code.


Examples in This Tutorial

Title
How to display headings in an HTML document.

Hidden comments
How to insert comments into HTML source code.

Horizontal Line
How to insert a horizontal line.


HTML Tag Reference Manual

The Runoob Tutorial tag reference manual provides more information about these headings and their attributes.

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

tag Description
Defines an HTML document
Defines the body of the document

-

Defines an HTML heading

Defines a horizontal line
Defines a comment