Lowercase Elements and Attributes


The HTML specification never mandated a particular letter case for our pages’ markup elements. As a result, developers have become accustomed to writing elements and their attributes in any case at all:

<P CLASS=Warning>Alert!</P>

In XHTML, all elements and their attributes must be written in lowercase. This is because XML is quite case-sensitive. For example, <body>, <Body>, and <BODY> would be considered three different elements. Because of this, the authors of the XHTML specification standardized on lowercase:

<p class=”Warning”>Alert!</p>

You may notice that we’ve kept the value of Warning intact for our class attribute. This is perfectly acceptable in XHTML because attribute values may be in mixed case (for example, pointing the href of a link to a case-sensitive server). However, they must be quoted.