Skip navigation

Headings and Paragraphs

Using Headings, Paragraphs, and Line Breaks
Let's start out with heading tags. These tags are good for creating titles or section headings. Here are some examples:

<h1>Large Heading!</h1>  will give us:

Large Heading!

<h2>Heading 2</h2>

Heading 2

<h3>Heading 3</h3>

Heading 3

<h4>Getting Small</h4>

Getting Small

<h5>Smaller Still...</h5>
Smaller Still...
<h6>You must have good vision...</h6>
You must have good vision...
Okay, I think you get the idea here. Now let's move on to a line break. The tag for a line break is <br />. When you insert this tag in your document, the contents will go to the next line. The <br /> tag does not need a closing tag afterward. Here is an example:

End this line now!!<br />Thanks!

This will generate the following:

End this line now!!
Thanks!

Basically, a line break is like hitting the "enter" key when you are writing text. The browser will not go to the next line until it runs out of space, or sees a tag that will force it to the next line. So typing the following in your text editor will display only one line of text in the browser:

Hello,
I want
a new line.

This gives us:

Hello, I want a new line.

To make the text move to the next line, use your <br /> tag from above:

Hello,<br />
I want<br />
a new line.

Now this will do what we wanted it to do:

Hello,
I want
a new line.

Now, let's move on to the paragraph tag, <p>. This tag will skip a vertical space after going to the next line, as though you had typed <br /> twice. This tag is good for skipping a line quickly and for knowing where you wanted a new paragraph to begin. How about an example? Well, O.K.:

This is some cool stuff.
<br />
This is the next line.
<p>
This is a new paragraph. Is this cool or what?
</p>

This will give us the following:

This is some cool stuff.
This is the next line.

This is a new paragraph. Is this cool or what?

So, now you can create a Web page full of text. Isn't it great? Well, there is still more of this in the next section, Manipulating Font Size and Color.

 

--------------------
Copyright © 1997-2008 The Web Design Resource. All rights reserved. Disclaimer.