You write HTML by using a variety of tags. A tag is typically an English word (or abbreviation) enclosed inside angle brackets. For instance, here is a paragraph tag:
Most HTML requires you to use both an opening and a closing tag. The opening and closing tags are identical, except the closing tag has a slash ( / ) after the first angle bracket and before the alphanumeric code. Here is the closing paragraph tag:
The code operates on the text between the opening and closing tags. For example:
<p>This is a paragraph.
For some tags, a closing tag is either inappropriate (there is no text contained in the tag to operate on) or not used. In these cases, instead of writing:
You can instead write:
It is always a good idea to close all tags, even if the browser can guess and understand an unterminated tag, since this helps with cross-browser compatibility and is the rule (rather than the convention) in XHTML.