Breaking Down Tags

Lets take a more official, formal look at the tag.

Tag Components

Tags have three main components:

<tagname attribute1="value1" attribute2="value2"...>
...(text or more tags go here)...
</tagname>

Attributes; Closing Tags

The closing of tags is a key difference between HTML and XHTML. See the XHTML section for details.

Not all tags require attributes to work properly. <html> and <head> almost never have attributes. However, all tags must close. For most tags this means they are accompanied by a closing tag, however, some tags self close. We will discuss these soon.

Attributes provide a lot of XHTML's flexibility and power, but for now, lets just talk about simple tags. We will discuss attributes in the next section.

Capitalization

The capitalization of tags is a key difference between HTML and XHTML. See the XHTML section for details.

All XHTML tags must be lowercase. Period, end of story. <BODY> is an invalid tag.

Misspellings and Misunderstandings

Vastly simplified, a browser processes an XHTML page something like this:

  1. Identify anything that is between angle brackets (< >) as a "tag"
  2. Determine whether the browser has any instructions for using the tag:
    • If yes, the tag is real -- follow the instructions
    • If no, the tag is garbage -- ignore it

When a browser ignores a tag, that means one of two things:

  1. The tag is misspelled or does not exist. (<fizzbuzz>, for example, is not an XHTML tag.)
  2. The tag is legal, but that particular browser does not support it.

An example of #2 is the <blink> tag. This tag works in Mozilla and in nearly all versions of Netscape Navigator. Safari and Internet Explorer do not support it.

This isn't a terrible loss. The <blink> tag is a very annoying tag that nobody misses.