11<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22<html lang="en">
3- <!-- $Id: cascade.src,v 1.16 1997-10-21 00: 21:44 ian Exp $ -->
3+ <!-- $Id: cascade.src,v 1.17 1997-10-28 21:34:11 bbos Exp $ -->
44<HEAD>
55<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66<TITLE>Cascade</TITLE>
@@ -73,7 +73,7 @@ the following algorithm:
7373 <LI>
7474 Sort by specificity of selector: more specific selectors will
7575 override more general ones. The definition and calculation of
76- specificity is object-language dependent.
76+ specificity is object-language dependent.
7777
7878 <P> Pseudo-elements and pseudo-classes are counted as normal
7979 elements and classes, respectively.
@@ -122,7 +122,8 @@ In HTML, a selector's specificity is calculated as follows:
122122
123123<ul>
124124<li>(a) count the number of "id" attributes in the selector
125- <li>(b) count the number of "class" attributes in the selector
125+ <li>(b) count the number of other attributes in the selector
126+ (including class attributes)
126127<li>(c) count the number of element names in the selector
127128</ul>
128129
@@ -135,9 +136,10 @@ Some examples:
135136<PRE>
136137 LI {...} /* a=0 b=0 c=1 -> specificity = 1 */
137138 UL LI {...} /* a=0 b=0 c=2 -> specificity = 2 */
138- UL OL LI {...} /* a=0 b=0 c=3 -> specificity = 3 */
139- LI.red {...} /* a=0 b=1 c=1 -> specificity = 11 */
139+ UL OL~ LI {...} /* a=0 b=0 c=3 -> specificity = 3 */
140+ /H1 [REL=up]/ {...} /* a=0 b=1 c=1 -> specificity = 11 */
140141 UL OL LI.red {...} /* a=0 b=1 c=3 -> specificity = 13 */
142+ LI.red.level {...} /* a=0 b=2 c=1 -> specificity = 21 */
141143 #x34y {...} /* a=1 b=0 c=0 -> specificity = 100 */
142144</PRE>
143145</div>
0 commit comments