PGTUTOR.COM
You are here: HOME >> HTML tutor >> Lesson 5

HTML tutor- Lesson 5

In this lesson we'll learn two very important tags. I repeat: Very Important.

However before we begin I'd like to talk a bit about the future of HTML (XHTML). You've probably noticed that HTML has gotten strict along the way and you can expect the same to happen along the upcoming years. You might go to very famous websites, look at their source code and say, "How come these guys are breaking all these rules and yet so successful?" There are many reasons but the most common one is that those websites have probably been around for some time.

So if you see many successful websites using a font tag, that means nothing. You don't have to copy them.

With that in mind, you might have noticed that I only use lower case letters in my tags. For example, I use <b> and not <B>. This is just one more of these things that will be required in the future by XHTML.


Let's begin with the line break or <br> tag. What happens if you type the following poem in notepad.

<body>
Funny is laughter
Funny is fun
Funny is healthy
Funny is nice
Funny is amusing
Funny is comical



A pelt of pranks
Above the normal ranks
Is funny when it is on
Yet quite sad when gone
</body>

View your webpage here


So, what happened? To your web browser all these are equivalent: hitting five spaces, hitting the return key once, hitting the return key thousand times. All you'll see in your web browser is a single space character. So we use the br tag.

The br is written as <br> but more and more often you'll see <br /> being used. Why? XHTML requires every opening tag to be accompanied with a closing tag and <br> violates this rule. <br /> is the solution.

Try the following this time:

<body>
Funny is laughter <br />
Funny is fun <br />
Funny is healthy <br />
Funny is nice <br />
Funny is amusing <br />
Funny is comical <br />
<br />
<br />
<br />
A pelt of pranks <br />
Above the normal ranks <br />
Is funny when it is on <br />
Yet quite sad when gone <br />
</body>

View your webpage here

How about the following:

<body>
Funny is laughter <br />Funny is fun <br />
Funny is healthy <br />Funny is nice <br />
Funny is amusing <br />Funny is comical <br />
<br /><br /><br />
A pelt of pranks <br />Above the normal ranks <br />
Is funny when it is on <br />Yet quite sad when gone <br />
</body>

View your webpage here

It's the same thing. Use single br for a single break and multiplr br's for multiple breaks.


A very commonly used tag in HTML is <p>- the paragraph tag. You can use the align arrtibute with <p> but remember that it's not a valid part of HTML anymore. We'll learn in CSS how to do this properly.

For now all you need to know is that p is used to start a new paragraph. You can think of it (for now) as using two br tags but don't forget the closing tag for p.

<body>
<p>This is the first paragraph. </p>
<p>This is the second paragraph. </p>
</body>

View your webpage here

Once again, you'll notice that some people omit the closing p tag- </p>. I've said this many times before and will say it again- stick to rules.

PgTutor - The easy way to make a website ...
Lessons: Intro 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25



PGTUTOR is an award winning website. In the past 2 years, we've won over 20 legitimate awards. Go to our awards page to verify for yourself.




You're not taking a risk when buying our products. If for any reason you're unsatisfied with the quality of our product(s), we'll refund your money. Also, you get to keep the product you bought.