Chapter 2. Using Common HTML Tags
In this lesson I introduce some common HTML tags. However, this is not a book on HTML. For more information about HTML please see the Wrox book Beginning HTML, XHTML, CSS, and JavaScript (Duckett, 2009, Wrox).
Note
The best way to learn HMTL is to study how other people use it. For example, in Internet Explorer 8, you can view the source of a web page by selecting View Source from the Page menu.
HEADINGS
Headings are used to divide sections of text in a hierarchical manner. HTML defines six levels of headings, ranging from <h1>
for the most important to <h6>
for the least important:
<h1>Heading 1</h1> <h2>Heading 2</h2> <h3>Heading 3</h3> <h4>Heading 4</h4> <h5>Heading 5</h5> <h6>Heading 6</h6>
Figure 2-1 shows each of the six levels of headings. An important thing to notice about headings is that they always appear on their own line. They are considered block-level elements.
Once you have your added your headings, it's time to add some text. Text is divided into paragraphs, and the HTML tag for paragraph is <p>:
<p>This is my first paragraph. It is a very short paragraph by design.</p>
The paragraph element automatically creates some space before and after itself, therefore it is also a block-level element. Many people are tempted to use the line break element (<br />
) to create paragraphs. They do this by placing two line breaks in a row. However, you should avoid this temptation. If you separate your paragraphs using line breaks, you will not be able ...
Get ASP.NET 4 24-Hour Trainer now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.