HTML Headings


Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading. <h6> defines the smallest heading. Note that browsers automatically add an empty line before and after headings.
   <h1>This is a heading</h1>
   <h2>This is a heading</h2>
   <h3>This is a heading</h3>
Headings Are Important.
Use HTML headings for headings only. Do not use headings to make text big or bold. Search engines use your headings to index the structure and content of your web pages. Since users may skim your pages by its headings, it is important to use headings to show the document structure. H1 headings should be used as main headings, followed by H2 headings, then less important H3 headings, and so on.

HTML Rules (Lines)
The <hr /> tag is used to create an horizontal rule (line).
   <p>This is a paragraph</p>
   <hr />
   <p>This is a paragraph</p>
HTML Comments
Comments can be inserted in the HTML code to make it more readable and understandable. Comments are ignored by the browser and are not displayed. Comments are written like this:
   <!-- This is a comment -->
HTML Tip—How to View HTML Source
Have you ever seen a web page and wondered “Hey! How did they do that?” To find out, right-click in the page and select “View Source” (IE) or “View Page Source” (Firefox) or similar for other browsers. This will open a window that shows you the HTML code of the page.

Demonstration
The following demonstration shows how the HTML script is displayed on the Web.

     


Review: HTML Headings
Which is the correct HTML element for the largest heading?
      <head>
      <h1>
      <h6>
      <heading>
Result: