<p>ordinary default text </p>
<p id=”highlight”>highlighted text </p>
</body>
</html>
Specifying more than one class .........................................................
You can use multiple class names in a single HTML element. For example,
you can create separate class rules (one for framed and one for pink) and
then combine them by naming them in an element’s class attribute in the
HTML like this:
<p class=”framed pink”>
For an explanation of how this works, and a code example illustrating it, see
the section in Chapter 18 titled “Combining Classes.”
Capitalizing on case-sensitivity .........................................................
HTML and CSS code is (usually) not case-sensitive. Tag names, attribute names,
and so on can be capitalized any way you wish — and the browser still under-
stands that you’re referring to a single entity. For example, BODY, Body, body,
or BoDy all are allowable body tags and can be used interchangeably.
As always, though, someone decided to get a little funny with this sensible
case-insensitivity rule. In HTML or XHTML (eXtensible HTML, which is XML
blended into HTML), ID and class values are case-sensitive. The CSS style def-
inition’s capitalization must match the capitalization in your document. The
following CSS style
p.yellow {color: yellow;}
doesn’t match the use of Yellowin this line in the document (the Y is upper-
case). This line is not yellow, because the style is not applied:
<p class=”Yellow”>This is black!</p>
Another exception to the usual case-insensitivity of CSS and HTML is the
value of a TYPEattribute in an OL(ordered, numbered list) element. It is case-
sensitive.
40 Part I: The ABCs of CSS