11<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22<html lang="en">
3- <!-- $Id: cascade.src,v 2.20 1998-03-22 02:03:01 ijacobs Exp $ -->
3+ <!-- $Id: cascade.src,v 2.21 1998-03-23 02:42:14 bbos Exp $ -->
44<HEAD>
55<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66<TITLE>Assigning property values, Cascading, and Inheritance</TITLE>
@@ -187,7 +187,7 @@ same property.
187187</div>
188188
189189<h3>The <span class="index-def" title="inherit, definition
190- of"><a name="value-def-inherit">inherit</a></span>
190+ of"><a name="value-def-inherit">' inherit' </a></span>
191191value</h3>
192192
193193<P>Each property may also have a specified value of 'inherit', which
@@ -205,15 +205,15 @@ part of the user's style sheet, black text on a white background will
205205be enforced throughout the document.
206206
207207<PRE>
208- BODY {
209- color: black !important;
210- background: white !important;
211- }
212-
213- * {
214- color: inherit !important;
215- background: transparent;
216- }
208+ BODY {
209+ color: black !important;
210+ background: white !important;
211+ }
212+
213+ * {
214+ color: inherit !important;
215+ background: transparent;
216+ }
217217</PRE>
218218
219219</div>
@@ -226,13 +226,14 @@ http://lists.w3.org/Archives/Member/w3c-css-wg/1998JanMar/0054.html
226226<H2><a name="at-import">The @import rule</a></h2>
227227
228228<P>The <span class="index-def"
229- title="@import"><dfn>'@import'</dfn></span> rule allows users to import
230- style rules in other style sheets. The '@import' keyword must be
231- followed by the URI of the style sheet to include. Any @import rules
232- must precede all rule sets in a style sheet.
229+ title="@import"><dfn>'@import'</dfn></span> rule allows users to
230+ import style rules from other style sheets. The '@import' keyword must
231+ be followed by the URI of the style sheet to include. (A string is
232+ also allowed: it will be interpreted as if it had url(...) around
233+ it.). Any @import rules must precede all rule sets in a style sheet.
233234
234235<div class="example"><P>
235- Both of these import rules are valid; the
236+ Two examples: both of these import rules are valid; the
236237first one illustrates that the "url()" syntax may be replaced by a
237238string in the
238239@import rule:</p>
@@ -407,15 +408,15 @@ lose to the second author rule since the second rule is
407408function also within author style sheets.
408409
409410<PRE>
410- /* From the user's style sheet */
411- P { text-indent: 1em ! important }
412- P { font-style: italic ! important }
413- P { font-size: 18pt }
414-
415- /* From the author's style sheet */
416- P { text-indent: 1.5em !important }
417- P { font: 12pt sans-serif !important }
418- P { font-size: 24pt }
411+ /* From the user's style sheet */
412+ P { text-indent: 1em ! important }
413+ P { font-style: italic ! important }
414+ P { font-size: 18pt }
415+
416+ /* From the author's style sheet */
417+ P { text-indent: 1.5em !important }
418+ P { font: 12pt sans-serif !important }
419+ P { font-size: 24pt }
419420</PRE>
420421</div>
421422
@@ -424,36 +425,37 @@ function also within author style sheets.
424425<P>A selector's specificity is calculated as follows:</p>
425426
426427<ul>
427- <li>(a) count the number of ID attributes in the selector
428- <li>(b) count the number of other attributes and pseudo-classes
429- in the selector
430- <li>(c) count the number of element names in the selector
431- <li>(d) ignore pseudo-elements.
428+ <li>count the number of ID attributes in the selector (= a)
429+ <li>count the number of other attributes and pseudo-classes
430+ in the selector (= b)
431+ <li>count the number of element names in the selector (= c)
432+ <li>ignore pseudo-elements.
432433</ul>
433434
434- <P>Concatenating the three numbers (in a number system with a large
435+ <P>Concatenating the three numbers a-b-c (in a number system with a large
435436base) gives the specificity.
436437
437438<div class="example"><P>
438439Some examples:
439440
440441<PRE>
441- * {} /* a=0 b=0 c=0 -> specificity = 0 */
442- LI {} /* a=0 b=0 c=1 -> specificity = 1 */
443- UL LI {} /* a=0 b=0 c=2 -> specificity = 2 */
444- UL OL+LI {} /* a=0 b=0 c=3 -> specificity = 3 */
445- H1 + *[REL=up]{} /* a=0 b=1 c=1 -> specificity = 11 */
446- UL OL LI.red {} /* a=0 b=1 c=3 -> specificity = 13 */
447- LI.red.level {} /* a=0 b=2 c=1 -> specificity = 21 */
448- #x34y {} /* a=1 b=0 c=0 -> specificity = 100 */
442+ * {} /* a=0 b=0 c=0 -> specificity = 0 */
443+ LI {} /* a=0 b=0 c=1 -> specificity = 1 */
444+ UL LI {} /* a=0 b=0 c=2 -> specificity = 2 */
445+ UL OL+LI {} /* a=0 b=0 c=3 -> specificity = 3 */
446+ H1 + *[REL=up]{} /* a=0 b=1 c=1 -> specificity = 11 */
447+ UL OL LI.red {} /* a=0 b=1 c=3 -> specificity = 13 */
448+ LI.red.level {} /* a=0 b=2 c=1 -> specificity = 21 */
449+ #x34y {} /* a=1 b=0 c=0 -> specificity = 100 */
449450</PRE>
450451</div>
451452
452453
453454<P>In HTML, values of an element's "style" attribute are style sheet
454- rules. These rules have no selectors, but for the purpose of step 4 of
455+ rules. These rules have no selectors, but for the purpose of step 3 of
455456the cascade algorithm, they are considered to have an ID selector
456- (specificity = 100).
457+ (specificity: a=1, b=0, c=0). For the purpose of step 4, they are
458+ considered to be after all other rules.
457459
458460<div class="html-example"><P>
459461<PRE>
0 commit comments