|
1 | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | 2 | <html lang="en"> |
3 | | -<!-- $Id: cascade.src,v 2.24 1998-04-23 23:10:53 ijacobs Exp $ --> |
| 3 | +<!-- $Id: cascade.src,v 2.25 1998-04-26 23:04:14 bbos Exp $ --> |
4 | 4 | <HEAD> |
5 | 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
6 | 6 | <TITLE>Assigning property values, Cascading, and Inheritance</TITLE> |
@@ -280,44 +280,48 @@ the same precedence rules apply. |
280 | 280 |
|
281 | 281 | <H3><a name="cascading-order">Cascading order</a></H3> |
282 | 282 |
|
| 283 | +<!-- Removed concept of "algorithm" [12/4/1998,BB] --> |
283 | 284 | <P>To find the value for an element/property combination, user agents |
284 | | -must apply the following algorithm:</p> |
| 285 | +must apply the following sorting order:</p> |
285 | 286 |
|
286 | 287 | <OL> |
287 | 288 | <LI> |
288 | 289 | Find all declarations that apply to the element and property in |
289 | 290 | question, for the target <a href="media.html">media type</a>. |
290 | 291 | Declarations apply if the associated selector <A |
291 | | - HREF="selector.html">matches</A> the element in question. If no |
292 | | - declarations apply, terminate the algorithm. |
| 292 | + HREF="selector.html">matches</A> the element in question. <!-- If no |
| 293 | + declarations apply, terminate the algorithm. --> |
293 | 294 |
|
294 | 295 | <LI> |
295 | | - Sort the declarations by weight and origin: For normal |
| 296 | + The primary sort of the declarations is by weight and origin: for normal |
296 | 297 | declarations, author style sheets override |
297 | 298 | user style sheets which override the default style sheet. For |
298 | 299 | <span class="index-def" title="important">"!important"</span> |
299 | 300 | declarations, user style sheets override author style sheets |
300 | 301 | which override the default style sheet. |
| 302 | + "!important" declaration override normal declarations. |
301 | 303 | An imported style sheet has the same |
302 | 304 | origin as the style sheet that imported it. |
303 | 305 |
|
304 | 306 | <LI> |
305 | | - Sort by specificity of selector: more specific selectors will |
| 307 | + The secondary sort is by specificity of selector: more specific selectors will |
306 | 308 | override more general ones. <!-- The definition and calculation |
307 | 309 | of specificity depends on the document language (see below). [I |
308 | 310 | don't think so. BB]--> |
309 | 311 | Pseudo-elements and pseudo-classes are counted as normal |
310 | 312 | elements and classes, respectively. |
311 | 313 |
|
312 | | - <LI> Sort by order specified: if two rules have the same weight, |
| 314 | + <LI> Finally, sort by order specified: if two rules have the same |
| 315 | + weight, origin and specificity, |
313 | 316 | the latter specified wins. Rules in imported style sheets are |
314 | 317 | considered to be before any rules in the style sheet itself. |
315 | 318 | </OL> |
316 | 319 |
|
| 320 | +<!-- |
317 | 321 | <P>The search for the property value must be terminated when any of |
318 | 322 | the above steps yields a rule that has a higher weight than the other |
319 | 323 | rules that apply to the same element/property combination. |
320 | | - |
| 324 | +--> |
321 | 325 | <!-- |
322 | 326 | <P>Note that "!important" may occur in author's and UA's style sheets, |
323 | 327 | but only has an effect in the user's style sheets. |
|
0 commit comments