Sunday, April 6, 2014

HTML Headings

HTML Headings


Heading elements implement six levels of document headings, <h1> is the most important and <h6> is the least. A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically.


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.



Exercises HTML Code (Headings):



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>HTML Headings</title>

</head>


<body>



<h1>This is a heading 1</h1>

<h2>This is a heading 2</h2>

<h3>This is a heading 3</h3>

<h4>This is a heading 4</h4>

<h5>This is a heading 5</h5>

<h6>This is a heading 6</h6>

</body>

</html>

Here is the result of this code:

Notice that each heading has a line break before and after each heading display. This is a built in attribute so to speak associated with the heading tag. Each time you place a heading tag, your web browser automatically places a line break in front of your beginning tag and after your ending tag exactly the same as with <p> tags.


No comments:

Post a Comment