HTML Text Tags Basics
By Stephen Bucaro
Today, most webpage text design is accomplished through the use of style definitions rather than html
tags. Although style definitions are extremely powerful for text design, they are also very complicated.
For example, through the principle of cascading a designer may loose track of exactly where a text
style was defined. However, html text definitions are always with the text that they apply to.
Text on a webpage should always be placed inside a container. The container may be a table cell or an
html span or div element, but the most commonly used container for text is a paragraph,
which is designated by the <p> and </p> tags.
In pure html the font would be defined using the <font> tag. The W3C (World Wide Web Consortium)
does not recommend using the font tag because it's "deprecated". Deprecated means at some point in the
future it will no longer be supported by Web browsers. However, I believe because the Web contains
millions of old webpages that use the font tag, and thousands of new webpages are being created each day
using the font tag, it will be supported long into the future.
<p><font face="Verdana" color="red" size="3">Red Verdana text in size 3</font></p>
Red Verdana text in size 3
Shown above is an example of use of the font tag. It defines the Verdana font in the color red and
in the size 3. Font size can be a value from 1 to 7.
<p style="font-family:verdana; font-size:16px; color:red">Red Verdana text 16 pixels in size.</p>
Red Verdana text 16 pixels in size.
If you want to heed the "deprecated" warning, shown above is an example of the same text without
the font tag, the text being defined by the style attribute of the paragraph tag.
Using HTML Tags to Format Text
You can also use style to define text boldness, italics, and underline. However, defining these
attributes with html requires less code and is easier to remember and easier to debug.
Simply place the <b> tag before and the </b> after any text you want to appear bold.
Place the <i> tag before and the </i> after any text you want to appear italic. Place
the <u> tag before and the </u> after any text you want to appear underlined.
I do not recommend using the html underline tag because Web users tend to mistake underlined text
for links. They'll be clicking on our underlined text and think you have a bad link. I also want
to point out that using the styles text-decoration property you can define overline
and line-through along with underline.
Using HTML Tags to Make Text Bold
Shown below is an example of use of the html bold text tag.
<p>This text is normal <b>this text is bold</b> this text is normal.</p>
This text is normal this text is bold this text is normal.
The <strong> tag does exactly the same thing. I first ran into the strong tag being used
by Microsoft FrontPage. In my opinion it's a totally unnecessary tag.
<strong>Defines strong text</strong>
Defines strong text
|