Thursday, February 9, 2012

HTML Headings

Headings are important in HTML documents.

HTML Headings

Headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines the least important heading.

<html>
<body>

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>

</body>
</html>


This is heading 1

This is heading 2

This is heading 3

This is heading 4

This is heading 5
This is heading 6

Note: Browsers automatically add some empty space (a margin) before and after each heading.

Headings Are Important

Use HTML headings for headings only. Don't 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 the less important H3 headings, and so on.

HTML Lines

The <hr /> tag creates a horizontal line in an HTML page.

The hr element can be used to separate content:

<html>
<body>
<p>The hr tag defines a horizontal rule:</p>
<hr />
<p>This is a paragraph</p>
<hr />
<p>This is a paragraph</p>
<hr />
<p>This is a paragraph</p>
</body>
</html>





The hr tag defines a horizontal rule:

This is a paragraph

This is a paragraph

This is a paragraph


HTML Comments

Comments can be inserted into 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>
<body>

<!--This comment will not be displayed-->
<p>This is a regular paragraph</p>

</body>
</html>

This is a regular paragraph

Note: There is an exclamation point after the opening bracket, but not before the closing bracket.


<html>
<!--my html practice doc it is -->
<body>
<h1>MY HTML PRACTICE</h1>
</br><hr />
<p>my first paragraph</p>
<h2>second heading</h2>
</br>
<hr />
</body>
</html>





MY HTML PRACTICE



my first paragraph

second heading