What's In A Name?

After Romeo posed this question in Shakespear's famous play, Juliet replies, "That which we call a rose by any other name would smell as sweet." Unfortunately, what is true for on stage love is far from the reality of on line HTML!

I see so many mistakes in HTML coding, that lead to hours of frustration, caused by a simple lack of understanding of the name and proper usage of HTML tags. I truly believe that if you know the tag name, the rules about using attributes (and what they are!) and the way it all goes together, you will have far less errors.

HTML tags are made up of distinct parts with simple rules that control how they are used. You need to understand this in order to use them correctly.

All HTML tags are enclosed in pointed brackets and have a single part name. For example, these are valid HTML tags:

<P>   <A>   <TABLE>   <BLOCKQUOTE>

And these are not valid HTML tags:

<A HREF>   <BACK GROUND>   <BG COLOR>   <BORDER COLOR>

HTML tag names are always made up of only one word (one or more letters without spaces). When you see tags with more than one word, then it is a tag with a name and attributes.

Attributes are made up of a single keyword and may be followed by one or more parameters separated from the keyword by an equal sign. Attributes are separated from each other and from the tag name by a single space and are typically enclosed in quotation marks (") -- see note at bottom of page.

Here is an example of an HTML tag with multiple attributes:

<FONT SIZE="3" COLOR="#CC0000" FACE="verdana">

Attributes can have mulitple parameters. When an attribute has more then one parameter, each parameter is separated from the other by a comma.

Here is an example of an HTML tag with an attribute with multiple parameters:

<FONT FACE="verdana, arial, ms sans serif">

Note that the last parameter, ms sans serif has multiple words or parts.

BGCOLOR and BACKGROUND are attributes, not tag names. They might be found in a TABLE tag, for example:

<TABLE BGCOLOR="#FFFF6E" BACKGROUND="paleblue.jpg">

HREF is an attribute that is found in the A or Anchor tag:

<A HREF="http://www.ourhutch.com/" TARGET="_blank">

The tag name is A, and not A HREF -- you can easily see that now, but perhaps even more so when you consider that it is only the tag name which always comes first. Attributes can come in any order. This is just as valid an HTML tag as the example above:

<A TARGET="_blank" HREF="http://www.ourhutch.com/">

Understanding the parts of an HTML tag and knowing that the name is always first and is always only one word, will help you make less mistakes in future. Realizing that there can be none, one or more attributes and that they can come in any order helps too.


Note: Quotation marks around attribute parameters, like:

bgcolor="#dd0cf8"

are sometimes optional. That is, this would also be correct usage:

bgcolor=#dd0cf8

There are some instances where quotation marks are required, such as when there are spaces in the parameter, like this:

face="times new roman"

or when there are alternate choices, like this:

face="corbin, verdana, arial"

Sometimes required. Sometimes optional. It's confusing. The thing is, you can always use them. There is never a time when they are not acceptable. So the easiest way is simply to use them in every instance.

I've heard it said on the eBay help boards by at least one expert that "eBay's servers don't like quotation marks" and this wisdom has been passed around quite a bit. In fact, it is a false statement. eBay's servers accept quotation marks around attribute parameters just like any other web server on the 'net. Where problems creep in is when you forget one of the pair of quotation marks (they must always be used in pairs) or when you edit your HTML code with a word processor like MSWord that may use non-standard quotation marks. It is these errors, and not the use of quotation marks themselves, that causes problems with eBay's servers (and any other servers for that matter!).

Using a word processor like MSWord or Word Perfect to create HTML code is seldom a good idea. It can be done and some people will tell you it works just fine for them, but especially for the beginner, stick to a simple text editor like NotePad or Bedit.


It's always the right time to use good code!

[ back to main | back to top ]


Copyright © 2002 by Stephen B. Henry