Any HTML document consists of text to be displayed by the browser mixed in with mark up information which controls how the text is displayed. The mark up information consists of tags. A tag consists of a type indicating word and various optional attributes which usually have associated values. Here's an example
<img src=me.gif align=right>Here the tag type is img and it has two attributes src and align. The attributes have the values me.gif and right respectively.
Tags are distinguished from the surrounding text by being enclosed in angle brackets < ..... > Within a tag the first item must be the tag type, this can be in either upper case or lower case. Many HTML generators seem to prefer upper case and there is some force in the argument that this practice makes the tag more distinct from the normal text.
If a browser does not recognise a tag it will ignore the tag and its attributes.
Many tags are container tags which means there is both an opening tag (which includes the attributes) and a closing tag forming a pair such as <type ... > .... </type>. In a few cases the closing tag is optional and is inferred from the next tag encountered. The commonest examples are the <p>, <li> and <td> meaning that it is not necessary to write </p> at the end of paragraph, the <p> at the start of the next paragraph implies the </p>.
If the closing tag is inferred then the tag in question cannot be nested, i.e you cannot have a paragraph within a paragraph, only a sequence of paragraphs. Tables and lists can, however, be nested.
Particular attributes are associated with particular tags in the HTML specification. If a browser does not recognise an attribute, it, and its associated value, will be ignored. The attribute identifier can be in upper case or lower case.
Not all attributes require values, although most do. The value appears after the attribute identifier and an equals sign (=).
The actual value should be enclosed within double quotes ("...") if it contains any characters that are defined as "unsafe" in the HTTP specification. Unsafe characters are any character other than a letter, a number and the characters $-_.+!*'()
The significance and case sensitivity of a value depends on the attribute. The only values that are normally case sensitive are annotation text elements, path components of URLs and the type attribute of the <ol> tag.
It is not entirely clear from the HTML standard whether spaces are allowed between the initial < and the type identifier and between the attribute identifier, the = symbol and the value.