Just stay in lowercase .........................................................................
In practice, most people, usually, try to write their programming, HTML, CSS
and other code entirely in lowercase. For one thing, it’s just easier to type. For
another thing, if case-sensitivity is in force, you won’t run into any problems
(or hard-to-track-down bugs) simply because you goofed up and used using
uppercase here and there. XHTML, in fact, requires all lowercase.
Additional case-sensitive exceptions are escape sequences beginning with an
ampersand (&) and Internet addresses (URLs). Not all URLs are case-sensitive,
but some are. This kind of confusion and inefficiency is really all too tedious
and unnecessary. One day, we programmers will get our collective act together
and insist that case-insensitivity be required in allcomputer programming
situations.
When Styles Cascade ....................................................................................
What does the term cascade mean for style sheets? It means that a CSS rule
tumbles down through the code, and sometimes bumps into a conflicting rule.
The cascade is about what programmers call precedence: Who wins
when there’s a conflict? More than one style can apply to a given tag. For
example, there’s always the default browser-defined style, such as black as
the default text color. If you specify some other color in a CSS rule, the
cascade allows your rule to dominate, to have precedence over the built-in
style.
But how does the browser decide which style wins out if two CSS rules con-
flict with each other? Should the conflicting styles be combined? What if the
styles are completely incompatible — such as one style specifying italic and
the other non-italic?
Visualizing specificity .........................................................................
Several factors determine which style wins out when styles collide: inheritance,
the structural tree in a document, and the specificity(or closeness) of a style
(I explain these concepts later in this section). Probably the most easily
understood collision rule involves wherethe style was defined. Your CSS
styles can be defined in four major locations:
Chapter 2: Getting Results with CSS 41