The HTML world is built around the notion of tags. A tag is a special string that denotes some special processing the browser must do. For example a tag could instruct the browser to bold a particular set of words, or insert an image at a particular point. Tags are described using the special characters < and >. There are many tags defined in the HTML language for defining a whole series of different presentation actions.
HTML tags are invisible to the final rendered page; they are instructions to the browser to do special formatting.
The most basic HTML tag is one that has no attributes associated with it. For example, consider the bold tag shown in the box beside. The opening the tag instructs the browser to start bolding the text upto the point it reads the end tag which stops the bolding formatting.
Another form of tag is one that has parameters or attributes associated with it. For example the tag that instructs the browser to create a link to another page is theA (anchor) tag. An example of this tag, can seen in the box above.
As we can see the basic makeup of this tag is very similar to the basic tag, except this time we have an extra HREF part to the opening tag. This instructs the browser which address to use when a user clicks on the link. This extra piece is called the tag parameter or attribute. This is formatted in a special way with no spaces in around the = sign, and the data of the attribute appearing in double quotes (" "). Failure to adhere to this formatting will cause parsing errors on your web page.
A classic question:
"So if every time the browser sees a < character and it assumes it's the start of the tag, how do I actually include the < in my page and not have it rendered as a tag?"
A HTML conundrum! All is not lost. The away round this is not to actually type the < but instead, insert a special code (or escape sequence) for the characters that may be interpreted as a tag. In this instance we replace < with < and > with >.
That may seem logical enough, but while it solves one problem it does create another one; how do we then write & sign if the browser will interpret these as a special escape sequence? Easy; we have an escape sequence for the & which is &.
There are a number of these special characters that should really be escaped. You can see a complete list of them here.
Tag names can be expressed in either upper or lower case. The browser does not care.
It is important you do not put any spaces in the tag name. < B> is illegal for example.
Tag attributes do not need to appear in one line; they can be placed on different lines as long as the individuate key=data pair is kept on the same line.
The closing tag is always the same name as the opening tag; but prefixed with a slash (/)
Closing tags never contain any attributes.
All tags should have a closing tag; some do not. It is safe to always specify one.