FFFF [css2] added example for 'inherit' · w3c/csswg-drafts@ad9e4e9 · GitHub
Skip to content

Commit ad9e4e9

Browse files
committed
[css2] added example for 'inherit'
changed specifity of non-css rules declared specificity of universal selector to be 0 --HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401230
1 parent 2652879 commit ad9e4e9

1 file changed

Lines changed: 40 additions & 5 deletions

File tree

css2/cascade.src

Lines changed: 40 additions & 5 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.15 1998-03-16 15:07:55 howcome Exp $ -->
3+
<!-- $Id: cascade.src,v 2.16 1998-03-17 00:37:55 howcome 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>
@@ -220,11 +220,35 @@ value</h3>
220220
<P>Each property may also have a specified value of 'inherit', which
221221
means that, for a given element, the property takes the same <a
222222
href="#actual-value">actual value</a> as the property for the
223-
element's parent.
223+
element's parent. The inherited value, which is normally only used as
224+
a fallback value, can be strengthend by setting 'inherit' explicitly.
224225

225-
<!-- Add an example here. Check out:
226+
<div class="example"><P>In the example below, the <span
227+
class="propinst-color">'color'</span> and <span
228+
class="propinst-background">'background'</span> properties are set on
229+
the BODY element. On all other elements, the 'color' value will be
230+
inherited and the background will be transparent. If these rules are
231+
part of the user's style sheet, black text on a white background will
232+
be enforced throughout the document.
233+
234+
<PRE>
235+
BODY {
236+
color: black !important;
237+
background: white !important;
238+
}
239+
240+
* {
241+
color: inherit !imporatant;
242+
background: transparent;
243+
}
244+
</PRE>
245+
246+
</div>
247+
248+
249+
<!-- Add another example?. Check out:
226250
http://lists.w3.org/Archives/Member/w3c-css-wg/1998JanMar/0054.html
227-
-IJ -->
251+
-IJ, HWL -->
228252

229253
<H2><a name="at-import">The @import rule</a></h2>
230254

@@ -445,6 +469,7 @@ base) gives the specificity.
445469
Some examples:
446470

447471
<PRE>
472+
* {} /* a=0 b=0 c=0 -&gt; specificity = 0 */
448473
LI {} /* a=0 b=0 c=1 -&gt; specificity = 1 */
449474
UL LI {} /* a=0 b=0 c=2 -&gt; specificity = 2 */
450475
UL OL+LI {} /* a=0 b=0 c=3 -&gt; specificity = 3 */
@@ -485,7 +510,7 @@ STYLE element because of cascading rule 4.
485510
than style sheets, for example the FONT element or the "align"
486511
attribute in HTML. If so, the non-CSS presentational hints must be
487512
translated to the corresponding CSS rules with specificity equal to
488-
1. The rules are assumed to be at the start of the author style sheet
513+
zero. The rules are assumed to be at the start of the author style sheet
489514
and may be overridden by subsequent style sheet rules.
490515

491516
<div class="note">
@@ -495,6 +520,15 @@ stylistic attributes to coexist with style sheets.
495520
</em>
496521
</div>
497522

523+
<div class="note">
524+
<P><em><strong>Note.</strong>
525+
In CSS1, the non-CSS presentational hints were given a specificity
526+
equal to 1, not 0. The change is due to the introduction of the
527+
universal selector which has a specificity of 0.
528+
</em>
529+
</div>
530+
531+
498532
</BODY>
499533
</html>
500534
<!-- Keep this comment at the end of the file
@@ -507,3 +541,4 @@ sgml-nofill-elements:("pre" "style" "br")
507541
sgml-live-element-indicator:t
508542
End:
509543
-->
544+

0 commit comments

Comments
 (0)