# HG changeset patch
# User Simon Sapin This document contains the CSS3 Paged Media Module W3C Last
Call Working Draft
- of 20 February 2013. The Last Call period ends on TBD.
Expected next revision to this document is another LCWD, due to the
@@ -1068,28 +1068,46 @@
the computations defined in the Selectors module:
+ Each comma-separated selectors in the same ‘ This is 0 or 1.
+
+ Concatenating the three numbers f-g-h gives the specificity.
+ Specificities are compared by comparing the three components in order:
+ the specificity with f larger a value is more specific; if the
+ two f values are tied, then the specificity with a larger
+ g value is more specific; if the two g values are
+ also tied, then the specificity with a larger h value is more
+ specific; if all the values are tied, the two specifities are equal.
+
+ Due to storage limitations, implementations may have limitations on
+ the size of f, g, or h. If so, values
+ higher than the limit must be clamped to that limit, and not overflow.
+
+ Note: Repeated occurrances of the same pseudo-classes are
+ allowed and do increase specificity.
Some page specificity calculation examples follow:
CSS Paged Media Module Level 3
- Editor's Draft 20 February 2013
+ Editor's Draft 21 February 2013
@page
’ rule match pages with its own specificity.
+ ‘@page
’ rules without selectors are considered
+ to have a single, empty selector (whose specificity is zero.)
+
-
- :first
’ or
- ‘:blank
’ pseudo-class, g=1; else g=0
-
- :left
’ or
- ‘:right
’ pseudo-class, h=1; else h=0
+ :first
’ or ‘:blank
’ pseudo-classes (= g)
+
+ :left
’ or ‘:right
’ pseudo-classes (= h)
- @page { } /* f=0 g=0 h=0 -> specificity = 000 */
- @page :left { } /* f=0 g=0 h=1 -> specificity = 001 */
- @page :first { } /* f=0 g=1 h=0 -> specificity = 010 */
- @page artsy { } /* f=1 g=0 h=0 -> specificity = 100 */
- @page artsy:left { } /* f=1 g=0 h=1 -> specificity = 101 */
- @page artsy:first { } /* f=1 g=1 h=0 -> specificity = 110 */
+@page { } /* specificity = (0,0,0) */
+@page :left { } /* specificity = (0,0,1) */
+@page :first { } /* specificity = (0,1,0) */
+@page artsy { } /* specificity = (1,0,0) */
+@page artsy:left { } /* specificity = (1,0,1) */
+@page artsy:first { } /* specificity = (1,1,0) */
@page {
-margin-left: 3cm;
+ margin-left: 3cm;
}
@page :left {
-margin-left: 4cm;
+ margin-left: 4cm;
}
@@ -1119,20 +1137,20 @@
@page :first {
-color: green;
-
-@top-left {
- content: "foo";
- color: blue;
+ color: green;
+
+ @top-left {
+ content: "foo";
+ color: blue;
+ }
+ @top-right {
+ content: "bar";
+ }
}
-@top-right {
- content: "bar";
-}
-}
@page { color: red;
-@top-center {
- content: "Page " counter(page);
+ @top-center {
+ content: "Page " counter(page);
}
}
diff -r b3accb3444d8 -r 0dff950123a2 css3-page/Overview.src.html
--- a/css3-page/Overview.src.html Wed Feb 20 16:24:59 2013 -0800
+++ b/css3-page/Overview.src.html Thu Feb 21 01:26:52 2013 +0100
@@ -769,24 +769,48 @@
computations defined in the Selectors
module:
Each comma-separated selectors in the same ''@page'' rule + match pages with its own specificity. + ''@page'' rules without selectors are considered to have a single, + empty selector (whose specificity is zero.) +
This is 0 or 1. +
Concatenating the three numbers f-g-h gives the specificity.
++ Specificities are compared by comparing the three components in order: + the specificity with f larger a value is more specific; + if the two f values are tied, + then the specificity with a larger g value is more specific; + if the two g values are also tied, + then the specificity with a larger h value is more specific; + if all the values are tied, the two specifities are equal. + +
+ Due to storage limitations, + implementations may have limitations on + the size of f, g, or h. + If so, values higher than the limit must be clamped to that limit, + and not overflow. + +
+Note: Repeated occurrances of the same pseudo-classes are allowed + and do increase specificity.
Some page specificity calculation examples follow:
- @page { } /* f=0 g=0 h=0 -> specificity = 000 */ - @page :left { } /* f=0 g=0 h=1 -> specificity = 001 */ - @page :first { } /* f=0 g=1 h=0 -> specificity = 010 */ - @page artsy { } /* f=1 g=0 h=0 -> specificity = 100 */ - @page artsy:left { } /* f=1 g=0 h=1 -> specificity = 101 */ - @page artsy:first { } /* f=1 g=1 h=0 -> specificity = 110 */ +@page { } /* specificity = (0,0,0) */ +@page :left { } /* specificity = (0,0,1) */ +@page :first { } /* specificity = (0,1,0) */ +@page artsy { } /* specificity = (1,0,0) */ +@page artsy:left { } /* specificity = (1,0,1) */ +@page artsy:first { } /* specificity = (1,1,0) */
Consider the following usage example:
@page { -margin-left: 3cm; + margin-left: 3cm; } @page :left { -margin-left: 4cm; + margin-left: 4cm; }-
Due to the higher specificity of the pseudo-class selector, the left margin on -left pages will be 4cm and all other pages -(the right-facing pages) will have a left margin of 3cm.
+Due to the higher specificity of the pseudo-class selector, +the left margin on left pages will be 4cm and all other pages +(the right-facing pages) will have a left margin of 3cm.
In this example, the higher specificity of the green rules wins over the red rule. Therefore the first page will have blue text in the top-left page-margin box @@ -817,20 +840,20 @@ while subsequent pages will have red text in the page-margin boxes.
@page :first { -color: green; + color: green; -@top-left { - content: "foo"; - color: blue; -} -@top-right { - content: "bar"; -} + @top-left { + content: "foo"; + color: blue; + } + @top-right { + content: "bar"; + } } @page { color: red; -@top-center { - content: "Page " counter(page); + @top-center { + content: "Page " counter(page); } }