Module Review X21c: Understanding the Cascade QUESTIONS --------- 1. Define "cascade" in the context of Cascading Stylesheets 2. Explain the concept of "specificity". 3. Explain the effect on specificity of grouping selectors in a style. 4. What is the specificity level of each of the following? § selectors ___ § classes ___ § IDs ___ § pseudo-classes ___ § pseudo-elements ___ § inline styles - officially: ___ - in practice: ___ 5. Discuss the specificity effect of the !important modifier. 6. Explain the role of inheritance in applying styles. 7. What is the effect of rule- ordering in applying styles? ANSWERS ------- 1. "The cascade" is the way in which styles interact with one another, how they flow from one element to another in the tree-diagram browsers construct for themselves. [X21cA1] 2. Specificity is a simple calculated way to figure out which rule prevails when two are in conflict. [X21cB1] 3. When selectors are grouped together without commas to indicate a rule that applies to one selector only when it's inside another, the specificities are added together. When selectors are separated by commas, each retains its own specificity of 1. [X21cC1] 4. What is the specificity level of each of the following? § selectors 1 § classes 10 § IDs 100 § pseudo-classes 10 § pseudo-elements 10 § inline styles 100 (officially) § 1000 (in practice) [X21cD1] 5. The !important modifier adds a specificity of 10,000 to a property [X21cE1] 6. An element may have stylistic properties that are inherited, and others that are not. Those that are inherited are passed along to all elements contained in the first element - that is, those that hang from it in the tree-diagram. However, if the contained elements are assigned different values for the inherited property, the assigned value will have greater specificity, and so replace the inherited value.. [X21cF1] 7. The rule that comes last wins. [X21cG1]