Skip to content

Commit 6797840

Browse files
committed
[css2] Removed override and Fixed semantics of important
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401169
1 parent 908e825 commit 6797840

1 file changed

Lines changed: 37 additions & 34 deletions

File tree

css2/cascade.src

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22
<html lang="en">
3-
<!-- $Id: cascade.src,v 2.11 1998-03-12 19:27:20 bbos Exp $ -->
3+
<!-- $Id: cascade.src,v 2.12 1998-03-14 23:30:05 ijacobs 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>
@@ -72,8 +72,12 @@ actual value is the computed value after any approximations have been
7272
applied.
7373

7474

75-
<P>Whenever an element inherits a value, it inherits an
76-
actual value.
75+
<P>In most cases, elements inherit actual values. However, there are
76+
some properties whose specified or calculated values may be inherited
77+
(e.g., a number value for the <span
78+
class="propinst-line-height">'line-height'</span> property). The
79+
definition of a property whose actual value is not what other elements
80+
inherit will clearly say so.
7781

7882
<h3>Order of value calculation</h3>
7983
<P><em>This section is under construction</em>
@@ -279,8 +283,10 @@ must apply the following algorithm:</p>
279283
Sort the declarations by weight.
280284
<span class="index-def" title="important">"!important"</span>
281285
declarations in the user's style sheet have more weight than
282-
all other declarations. <!-- or do !important declarations in
283-
author and UA ss still have some effect? -->
286+
all other declarations.
287+
<span class="index-def" title="important">"!important"</span>
288+
declarations in the author's style sheets have more weight than
289+
those in the UA's default style sheet.
284290

285291
<LI>
286292
Sort by origin: the author's style sheets override the user's
@@ -314,48 +320,45 @@ the reader. It is therefore important that the User Agent gives the
314320
user the ability to turn off the influence of a certain style sheet,
315321
e.g., through a pull-down menu.
316322

317-
<H3><a name="important-rules">!override and !important rules</a></H3>
323+
<H3><a name="important-rules">!important rules</a></H3>
318324

319325
<P>CSS attempts to create a balance of power between author
320-
and user style sheets. Authors are given "extra power" in the
321-
cascade (see point 3 above) so that, by default, the author's
322-
stylistic intentions will prevail. However, CSS offers two mechanisms
323-
that give more weight to user preferences: !important and !override
324-
declarations.
325-
326-
<P>An "!important" declaration (the keywords "!" and "important"
327-
follow the declaration) takes precedence over a normal declaration.
328-
Both author and user style sheets may contain "!important" declarations,
329-
and author "!important" rules override user "!important" rules.
330-
331-
<P>An "!override" declaration (the keywords "!" and "override" follow
332-
the declaration) takes precedence over an "!important" declaration.
333-
<em>Only</em> user style sheets may contain "!override" declarations,
334-
giving the user the final say in the cascade.
326+
and user style sheets. By default, rules in an author's style
327+
sheet override those in a user's style sheet (see cascade
328+
rule 3).
329+
330+
<P>However, for balance, an "!important" declaration (the keywords "!"
331+
and "important" follow the declaration) takes precedence over a normal
332+
declaration. Both author and user style sheets may contain
333+
"!important" declarations, and user "!important" rules override author
334+
"!important" rules.
335+
336+
<div class="note"><P>
337+
<em><strong>Note.</strong>
338+
This is a semantic change since CSS1. In CSS1, author "!important"
339+
rules took precedence over user "!important" rules. </em>
340+
</div>
335341

336342
<P>Declaring a shorthand property (e.g., <span
337-
class="propinst-background">'background'</span>) to be "!important"
338-
(respectively, "!override") is equivalent to declaring all of its
339-
sub-properties to be "!important" (respectively, "!override").
343+
class="propinst-background">'background'</span>) to be "!important" is
344+
equivalent to declaring all of its sub-properties to be "!important".
340345

341346
<div class="example"><P>
342347
The first rule of the user's style sheet in the following example
343-
contains two "!override" declarations. These user preferences will
344-
override all rules that have H1 as a <a
345-
href="selector.html#subject">subject</a>, namely the author's H1
346-
rule. For the P element, on the other hand, the <span
347-
class="propinst-font-size">'font-size'</span> will be '18pt' and the
348-
<span class="propinst-font-style">'font-style'</span> will be 'italic'
349-
since the author's "!important" rule takes precedence.</p>
348+
contains two "!important" declarations, which override
349+
the corresponding color and background properties in the
350+
author's style sheet even though the author has also specified
351+
"!important". The second rule of the user's style sheet will
352+
override the author's 'font-style' specification.</p>
350353

351354
<PRE>
352355
/* From the user's style sheet */
353-
H1 { color: black ! override; background: white ! override }
354-
P { font-size: 18pt ! important; font-style: normal ! important}
356+
H1 { color: black ! important; background: white ! important }
357+
P { font-size: 18pt; font-style: normal ! important}
355358

356359
/* From the author's style sheet */
357360
H1 { color: yellow ! important; background: blue ! important }
358-
P { font-size: 12pt; font-style: italic ! important }
361+
P { font-size: 12pt; font-style: italic }
359362
</PRE>
360363
</div>
361364

0 commit comments

Comments
 (0)