HTML Tutorial


Lesson 2
Tags and Text

You obviously want to do more than post a simple "Hello" on the web. Let's start by learning how to do more with text.

You can make text bold by using the <b> tag:
<b>Hello</b> = Hello
You can make text italicized by using the <i> tag:
<i>Hello</i> = Hello
You can use both the <b> and the <i> tag:
<b><i>Hello</i></b> = Hello
You can underline text using the <u> tag:
<u>Hello</u> = Hello
And of course you can do:
<b><i><u>Hello</u></i></b> = Hello

NOTE: While you can use multiple tags, always nest the tags properly by closing them in the reverse order from which you opened them (e.g., in the sample above, <u> is the last tag opened and </u> is the first tag closed).

If we did
<b>Hello</b>
<i>Hello</i>
<b><i>Hello</i></b>
we would get:
Hello Hello Hello

To break the text onto separate lines, we need to use the line break tag, <br>. This tag does not have a closing tag to go with it.
<b>Hello</b><br><i>Hello</i><br><b><i>Hello</i></b> would give us:
Hello
Hello
Hello

We could use the paragraph tag, <p>, instead of the line break tag, <br>,
<b>Hello</b><p><i>Hello</i><p><b><i>Hello</i></b> and get:
Hello

Hello

Hello
The closing tag, </p>, is optional.

To change the size of a font, we use the <font size=n> command:
<font size=-2>Hello</font> = Hello
<font size=-1>Hello</font> = Hello
<font size=+1>Hello</font> = Hello
<font size=+2>Hello</font> = Hello
<font size=+3>Hello</font> = Hello

You may also see the <hn> command used:
<h1>Hello</h1> =

Hello


<h2>Hello</h2> =

Hello


<h3>Hello</h3> =

Hello


<h4>Hello</h4> =

Hello


<h5>Hello</h5> =
Hello

<h6>Hello</h6> =
Hello

LESSON 1 | HOME PAGE | LESSON 3

© Geo. McCalip 2001