Font-Style Elements

I'm not a big fan of the font-style elements. But it's my duty to tell you about them. Maybe you'll find them useful.

Font-style elements are similar to phrase elements in that they are used to modify pieces of text. However, as the name implies, font-style elements are stylistic rather than structural in nature. And therein lies the rub. In HTML 4.0, most stylistic formatting is accomplished through style sheets. Font-style elements are an exception, a holdover from previous versions of HTML.

We'll examine four font-style elements here:

Bold

The bold element specifies that text should be rendered in boldface. Here's a sample paragraph which contains a bold element.

Important: All staff members are required to wear the funny hats.

Here's the code that makes it work:

<P>
 <B>Important:</B> All staff members 
 are required to wear the funny hats.
</P>

As you can see, the bold element is delimited by the <B> and </B> tags.

Italic

The italic element specifies that text should be rendered in an italic face. Here's a sample paragraph which contains an italic element.

But I don't want to wear a funny hat.

Here's the code that makes it work:

<P>
 But I don't <I>want</I> to wear a funny hat.
</P>

As you can see, the italic element is delimited by the <I> and </I> tags.

Small

The small element specifies that text should be rendered in a smaller size. Here's a sample paragraph with the small element:

Don't forget to read the fine print before you sign anything.

Here's the code:

<P>
  Don't forget to read the 
  <SMALL>fine print</SMALL> 
  before you sign anything.
</P>

As you can see, the small element is delimited by the <SMALL> and </SMALL> tags.

Big

The big element is similar to the small element, but it works in reverse. Here's a sample paragraph with the big element:

It's a really great sale!

Actually this paragraph contains three instances of the big element. They're nested inside one another to demonstrate their cumulative effect. (The small element works the same way.) Here's the code:

<P>
 It's a 
 <BIG>really <BIG>great <BIG>sale </BIG></BIG></BIG> 
</P>

As you can see, the big element is delimited by the <BIG> and </BIG> tags.

All font-style elements are inline elements.


| Introduction to HTML | Tutorials |