Chapter 4: Rules, Paragraphs, Breaks

Horizontal Rules

In this chapter we'll be looking at a few things... starting with rules. No, not the kind of rules you have to obey - These are horizontal rules. Putting a horizontal rule in a web-page will give you a long line across the screen. The code for a horizontal rule is nice and easy to remember: <hr>. Below is the result of putting a <hr> in this very web-page:


Notice that the hr is a self closing tag.

Paragraphs

Paragraphs you've seen already. To create a paragraph of text you use the <p> tag. Anything after the <p> is the content of that paragraph, all the way up to the closing </p> at the end. When you have created several paragraphs, you will find that they have what appears to be a single, empty line in between them. You don't actually put that line in... this is put in by the web-browser to make the paragraphs look like separate paragraphs.

This:

<p>This is the first paragraph</p>
<p>This is the second paragraph</p>
<p>This is the third paragraph</p>

and this:

<p>This is the first paragraph</p>

<p>This is the second paragraph</p>

<p>This is the third paragraph</p>

Will both produce the same output, which would look like this in this web-page:

This is the first paragraph

This is the second paragraph

This is the third paragraph.

As you can see, the browser ignores the extra gaps (white space) the tags. This is always the case in HTML. One space or more is always treated as a single space.

Breaks

The last tag, another that you've seen briefly in a previous chapter is the break, or new line tag. Text will automatically go onto a new line if it reaches past the end of the width of a web-page, but using the break tag <br>, you can force a new line:

Entering:

<p>Hello, I just thought I would demonstrate the use of the break <br> tag. As you can see, whenever I insert a break, I get<br><br>a new line!

Will produce:

Hello, I just thought I would demonstrate the use of the break
tag. As you can see, whenever I insert a break, I get

a new line!

Well, now you've learned about the tags in this chapter... why don't you try out using them yourself? And when you're done, it's time for a quiz.