What are HTML Tags?
 

Introduction

"Tags" are just the cute name for commands in HTML. Tags aren't so hard to use, as long as you follow a few simple rules. Donald St. John of CNET laid out five rules for tags which should help you understand them better:

  1. Tags are always surrounded by angle brackets (less-than/greater-than characters), as in <head>.
  2. Most tags come in pairs and surround the material they affect.

    They work like a light switch: the first tag turns the action on, and the second turns it off (There are some exceptions. For instance, the <br> tag creates a blank line and doesn't have an "off switch." Once you've made a line break, you can't unmake it.).
  3. The second tag--the "off switch"--always starts with a forward slash.

    For example, you turn on bold with <strong>, shout your piece, and then go back to regular text with </strong>.
  4. First tag on, last tag off.

    Tags can be nested, so when you start a tag within another tag, you have to close that inner tag before closing the outer tag. For instance, the page will not display properly with the tags in this order:

          <head><title>Your text</head></title>

    The correct order is:

          <head><title>Your text</title></head>
  5. Many tags have optional attributes that use values to modify the tag's behavior.

    The <p> (paragraph) tag's align attribute, for instance, lets you change the default (left) paragraph alignment. For example, you could centers the next paragraph on the page with the following tag.

          <p align="center">