How HTML tags work.
HTML tags are indicated by the less than (<) and greater than (>) symbols (the common slang is to call them angle bracket). An example of an HTML tag is: <html>.
You can use any combination of upper and lower case letters in an HTML tag, as long as you have the correct spelling. Any of the following are acceptable examples of the same HTML tag: <html>; <HTML>; <Html>; or even <hTmL>.
Most HTML tags occur in pairs: a starting tag (<b>) and an ending tag (</b>). The slash character(/) indicates an end tag.
Paired HTML tags apply to whatever is between them. As an example, the bold tag pair makes everything in between <b> into bold print </b>.
Paired tags can be nested, one pair completely inside the other. Some browsers will let you slide on some incorrectly nested paired tags, but most of the time crossing paired tags is as bad as crossing the streams in Ghost Busters (any of you old enough to remember that movie?).
Example of correctly nested tag pairs: <b>bold <i>italic</i> print</b>.
Example of incorrectly nested tag pairs: <b>bold <i>italic</b>print</i>.
When you have nested tags, the ending tags should be in the exact opposite order as the beginning tags.
Many tags will also accept attributes: (<OPTION SELECTED>).
Attributes are used to pick from a variety of options for a particular tag. For example, the <p> (paragraph) tag can have an alignment attribute, for left, right, or centered justification.
Attributes are written in the starting tag, after the less than symbol and command, but before the greater than symbol. In the following example, the correct location of an attribute is shown in bold: <p align=CENTER>
Almost all attributes have values (I had to really think for a while to come up with the example above of an attribute with no value).
Values are used to further define the choices of attributes.
Values are indicated by an equal sign (=) and then the value. There should be no spaces between the attribute and the equal sign and no spaces between the equal sign and the value. For example: <p align="center">.
Values can be anything from a number to a word to a phrase to a URL.
Inch marks (") are placed before and after a value. Do not use standard quotation marks ( and ).
An example would be: <IMG SRC="http:/radiant.org/bubastis/KUVAT/SMBAST.JPG">.
In theory, any value that is a single word (any number of letters) or single number (any number of digits) can be placed immediately after the equal sign. In practice, some browsers will occassionally get confused over the lack of a pair of inch marks.
If a value is more than one word or includes any punctuation or is a combination of letters and digits, then it must be placed inside a pair of inch marks.
Most attributes are limited to only a handful of valid values.
When a browser does not understand a particular tag, attribute, or value, it is supposed to ignore it. This was done so that HTML could be extended and expanded over time. New tags can be added, and old browsers wont break, instead theyll just miss out on new features.
Anyone can add new tags. In addition to all kinds of new tags added by Netscape and Microsoft as part of their browser wars, it is possible to add private tags for a variety of special purposes. One example of private tags are those used to provide information for web bots sent out by search engines and other on-line services.
The downside for a designer is that there are very few tags, attributes, and values that will be recognized and interpretted by all browsers.
You, as the designer of your web page, will have to make a decision about whom your web page is intended and what browsers that audience is likely to use.
You will continually face the choice of adding cool new features at the expense of cutting back on visitors or expanding the number of possible visitors at the expense of missing out on some of your presentation options.
| previous article | return to Web | next article |
Copyright © 1998 Milo (except as otherwise noted) All rights reserved.
This site made on Macintosh computers.
Best viewed with Netscape Navigator on an Apple
Macintosh
.
No Microsoft products used in the preparation of this web site.
updated March 26, 1998 C.E. © 1998 Milo
| Electric Emperor |