<h2>Cascading Style Sheets</h2>
<img class="alignright" title="Cascading Style Sheets" src="/images/teaching/cascade.jpg" alt="Braving the Cascade" width="250" height="250" />In the previous section, we introduced the basic concepts of CSS: Its rules, selectors, and how to incorporate CSS into a web page. This section we really dive into the cascade, examining the intricacies of CSS.

But first we step back and revisit how the browser parses XHTML into a family tree affectionately known as the DOM (Document Object Model). It is upon the members of this family tree, the individual XHTML elements, on which CSS operators. We learn that through a variety of CSS selectors, we can dole out styles to any element or combination of elements we want. And through the concept of inheritance, we explore how these styles can apply to either parent or child elements or more often than not, both.

We then identify the various sources of style sheets including the browser's internal style sheets, those provided by the reader, and finally those we, as web developers, author ourselves. We also revisit how CSS can be embedded in elements, web pages, and separate files. With so many sources and so many ways to select XHTML elements, we soon discover there's plenty of room for one rule to conflict with another.

Behold the power of the Cascade, which determines how one CSS rule is chosen over another. We break the cascade down into its fundamental parts--the source of a rule, the specificity of a rule's selector, and the order in which a rule--and show how each part plays a critical role in resolving conflicts. It's a daunting task at first, especially when we learn that math can be involved, but the ultimate lesson is this: The more we deal with the Cascade, the easier it is to navigate.
<h2>Resources</h2>
<ul>
	<li><a title="Section 03 Slides" href="/teaching/section_04_slides.pdf">Section 04 Slides</a> (PDF, 8.9 MB)</li>
	<li><a title="CSS Reference" href="http://www.w3schools.com/css/css_reference.asp">CSS Reference</a></li>
	<li><a title="W3C CSS Validator" href="http://jigsaw.w3.org/css-validator/">W3C CSS Validator</a></li>
	<li><a title="CSS Specifity Wars" href="http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html">CSS Specificity Wars</a></li>
	<li><a title="CSS Specifity for Poker Players" href="http://iamacamera.org/default.aspx?id=95">CSS Specificity for Poker Players</a></li>
	<li><a title="CSS Cheat Sheet" href="http://www.communitymx.com/content/article.cfm?cid=2795D">CSS Cheat Sheet: Inheritance, Cascade, Specificity</a></li>
</ul>
<a title="Return to teaching home" href="../../teaching-home/">Return to teaching home</a>