This document contains a table of testable assertions extracted from the CSS3 Paged Media Module, W3C Last Call Working Draft 10 October 2006 specification, and, for each assertion, a list of associated tests.
The content of the document is flowed into the page area.
The content area of a page box is called the page area.
The content area of a page box is called the page area.
The edges of the page area on the first page establish the rectangle that is the initial containing block of the document.
The properties of a page box are determined by properties declared within the page context, which is the declaration block of the @page rule.
Page boxes differ from other boxes in that the 'width' and 'height' properties do not apply to a page box.
The size of the page box is specified using the 'size' property in the page context.
Printing devices MAY adjust the layout of the document so that content falls within the printable area. How this adjustment is accomplished is device dependent within the constraints expressed in the sections Rendering page boxes that do not fit a page sheet and Content outside the page box.
Value: <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
Initial: auto
Applies to: page context
Media: paged
Computed value: specified value
auto: The page box will be set to the size and orientation of the page sheet chosen by the UA.
landscape: Specifies that the page's content be printed in landscape orientation. The page box is the same size as the page, and the longer sides are horizontal.
Specifies that the page's content be printed in portrait orientation. The page box is the same size as the page, and the shorter sides are horizontal.
When possible, output should be rendered on the media size indicated; if not available, the smallest larger size available should be used; if not available, the contents of the page box should be scaled down to fit the smaller page sheet.
When possible, output should be rendered on the media size indicated; if not available, a larger size should be used; if not available, the contents of the page box should be scaled down to fit the largest smaller page sheet.
When possible, output should be rendered on the media size indicated; if not available, a larger size should be used; if not available, the contents of the page box should be scaled down to fit the smaller page sheet.
<length> The page box will be set to the given absolute length. If only one length value is specified, it sets both the width and height of the page box (i.e., the box is a square).
Therefore, values in units of 'em' and 'ex' refer to the page context's font.
A5: The page box SHOULD be set to the size of ISO A5 media: 148mm wide and 210 mm high.
A4: The page box SHOULD be set to the size of ISO A4 media: 210mm wide and 297mm high.
A3: The page box SHOULD be set to the size of ISO A3 media: 297mm wide and 420mm high.
B5: The page box SHOULD be set to the size of ISO B3 media: 176mm wide and 250mm high.
B4: The page box SHOULD be set to the size of ISO B4 media: 250mm wide and 353mm high.
letter: The page box SHOULD be set to the size of North American letter media: 8.5in wide and 11in high.
legal: The page box SHOULD be set to the size of North American media: 8.5in wide and 14in high.
ledger: The page box SHOULD be set to the size of North American media: 11in wide and 17in high.
SSS User agents SHOULD also support Media Size Self-Describing Names as defined in Section 5 of [PWGMSN].
If a page box does not match the target page sheet dimensions, the user agent MAY choose (in order of preference) to: 1. Render the page box at the indicated size on a larger page sheet. 2. Rotate the page box 90° if this will make the page box fit the page sheet. 3. Scale the page box to fit the page sheet. (There is no requirement to maintain the aspect ratio of the page or of any elements on the page when scaling; however, preservation of the aspect ratio is preferred.) 4. Reformat the page contents, including 'spilling' onto other page sheets. 5. Clip overflowed content (least preferred).
Properties for the page box are specified within the page context.
The value 'auto' may not be used as a page name and MUST be treated as a syntax error.
The specificity of @page rules is computed in an analogous manner to the computations defined in the Selectors module:Concatenating the three numbers f-g-h gives the specificity.
- if an @page rule has a named page, f=1
- if an @page rule has a ':first' pseudo-class, g=1
- if an @page rule has a ':left' or ':right' pseudo-class, h=1
Page contexts cascade
The following properties can be used in the page context to style the appearance of the page box: ... 'size'
The following properties can be used in the page context to style the appearance of the page box: ... background properties
The following properties can be used in the page context to style the appearance of the page box: ... border properties
The following properties can be used in the page context to style the appearance of the page box: ... margin properties
The following properties can be used in the page context to style the appearance of the page box: ... padding properties
These properties can be used in the page context to set counters: ... counter-reset, counter-increment
These properties can be used in the page context to set counters: ... counter-reset, counter-increment
These properties can be used in the page context to style the content of margin boxes: ... color
These properties can be used in the page context to style the content of margin boxes: ... font properties
These properties can be used in the page context to style the content of margin boxes: ... text properties
That is, when set in the page context, the values become the initial values for the margin boxes.
Properties other than those listed above are invalid within the page context.
Values in units of 'em' and 'ex' refer to the page context's font.
Percentage values on the margin, padding and border properties are relative to the dimensions of the containing box (defined by the 'size' property in the page context).
The 'width' and 'height' properties do not apply to the page box
The page background applies to the entire page box, including the page margins.
A margin-box background is painted over (on top of) the page background.
The root element then paints the canvas within the page's padding box.
The origin of the page background is the upper-left corner of the page area.
When a page break splits a box, the box's margins, borders, and padding have no visual effect where the split occurs.
When printing double-sided documents, the page boxes on left and right pages MAY be different.
If different declarations have been given for left and right pages, the user agent must honor these declarations even if the user agent does not transfer page boxes to left and right sheets (e.g. a printer that only prints single-sided).
Add statement to spec.
Authors MAY also specify style for the first page of a document with the ':first' pseudo-class:
Please note that the margin boxes are oriented with respect to the content and are independent of page orientation
The following rules apply to 'top-left', 'top-center' and 'top-right' margin boxes, which are referred to as [1], [2], and [3], respectively, in the expression below.
The UA chooses used values for each box's width, left and right margin, left and right border thickness, and left and right padding. It chooses them in such a way that the value of: left-margin[1]² + left-margin[2]² + left-margin[3]² + right-margin[1]² + right-margin[2]² + right-margin[3]² is as small as possible under the constraints below. ("foo[n]" stands for the used value of property foo of the n'th box and "x²" for the square of x.)
The sum of the outer widths of the three boxes is equal to max box width.
max box width, which is the sum of the width of the page's left padding area, the width of the page area, and the width of the page's right padding area. In other words, it is the distance between the left page border and the right page border.
If the center box is not empty or if its computed width is not 'auto', then the outer widths of the other two boxes are equal to each other (i.e., the center box is centered in that case).
3. If a box is empty and its computed width is 'auto', then the used values of its left and right padding and left and right border are all 0.
3. If a box is empty and its computed width is 'auto', then the used values of its left and right padding and left and right border are all 0.
3. If a box is empty and its computed width is 'auto', then the used values of its left and right padding and left and right border are all 0.
The used values of the left box's left margin, the center box's left and right margin and the right box's right margin are their respective computed values, unless that computed value is 'auto'.
The used values of the left box's left margin, the center box's left and right margin and the right box's right margin are their respective computed values, unless that computed value is 'auto'.
The used values of the left box's left margin, the center box's left and right margin and the right box's right margin are their respective computed values, unless that computed value is 'auto'.
The used values of the left box's left margin, the center box's left and right margin and the right box's right margin are their respective computed values, unless that computed value is 'auto'.
7. The used values of the left box's right margin and the right box's left margin are their respective computed values, unless that computed value is 'auto'.
If the above constraints are contradictory ("over-constrained"), then constraint 7 is replaced by 7a:
7a. If the computed values of the left box's left and right margins are 'auto and not 'auto', respectively, then the used value of the right margin is its computed value. If the computed values of the right box's left and right margins are not 'auto' and 'auto', respectively, then the used value of the left margin is its computed value. This effectively means that the specified right margin of the left box is ignored if necessary, and ditto for the left margin of the right box.
7. The used values of the left box's right margin and the right box's left margin are their respective computed values, unless that computed value is 'auto'.
If the above constraints are contradictory ("over-constrained"), then constraint 7 is replaced by 7a:
7a. If the computed values of the left box's left and right margins are 'auto and not 'auto', respectively, then the used value of the right margin is its computed value. If the computed values of the right box's left and right margins are not 'auto' and 'auto', respectively, then the used value of the left margin is its computed value. This effectively means that the specified right margin of the left box is ignored if necessary, and ditto for the left margin of the right box.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for bottom-left, bottom-center and bottom-right are established by the same rules.
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for left-top, left-middle and left-bottom boxes are established by the same rules, with "width" replaced by "height", "left" by "top", "right" by "bottom" and "center" by "middle".
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
The used values for right-top, right-middle and right-bottom boxes are established by the same rules as for left-top, left-middle and left-bottom.
A margin box is instantiated if a margin context is established and one of the following conditions holds:
- The computed value of 'content' is not 'none'.
- The properties 'width' and 'height' are set in the margin context.
The value of the counter at the beginning of page processing MUST be used by default.
Value: auto | always | avoid | left | right
Initial: auto
Applies to: block-level elements
Inherited: no
Media: paged
auto: Neither force nor forbid a page break before (after, inside) the generated box.
always: Always force a page break before (after) the generated box.
left: Force one or two page breaks before (after) the generated box so that the next page is formatted as a left page.
right: Force one or two page breaks before (after) the generated box so that the next page is formatted as a right page.
avoid: Avoid a page break before / after / inside the generated box.
Value: auto | always | avoid | left | right
Initial: auto
Applies to: block-level elements
Inherited: no
Media: paged
auto: Neither force nor forbid a page break before (after, inside) the generated box.
always: Always force a page break before (after) the generated box.
left: Force one or two page breaks before (after) the generated box so that the next page is formatted as a left page.
right: Force one or two page breaks before (after) the generated box so that the next page is formatted as a right page.
Avoid a page break before / after / inside the generated box.
Value: auto | avoid
Initial: auto
Applies to: block-level elements
Inherited: yes
Media: paged
auto: Neither force nor forbid a page break before (after, inside) the generated box.
avoid: Avoid a page break before / after / inside the generated box.
Value: auto | <identifier>
Initial: auto
Applies to: block-level elements
Inherited: yes
If a block box with inline content has a 'page' property that is different from the preceding block box with inline content, then one or two page breaks are inserted between them, and the boxes after the break are rendered on a page box of the named type.
Value: <integer>
Initial: 2
Applies to: block-level elements
Inherited: yes
Media: visual
The 'orphans' property specifies the minimum number of line boxes in a block element that must be left at the bottom of a page.
Value: <integer>
Initial: 2
Applies to: block-level elements
Inherited: yes
Media: visual
The 'windows' property specifies the minimum number of line boxes of a block that must be left at the top of a page.
In the normal flow, page breaks may occur at the following places: 1. In the vertical margin between block boxes (or rows in a table). ... These breaks are subject to the following rules:
In the vertical margin between block boxes (or rows in a table). When a page break occurs here, the computed values of the relevant 'margin-top' and 'margin-bottom' properties are set to '0'.
In the normal flow, page breaks may occur at the following places: ... 2. Between line boxes inside a block box. These breaks are subject to the following rules:
Rule A: Breaking at (1) is allowed only if the 'page-break-after' and 'page-break-before' properties of all the elements generating boxes that meet at this margin allow it, which is when at least one of them has the value 'always', 'left', or 'right', or when all of them are 'auto'.
Rule B: However, if all of them are 'auto' and the nearest common ancestor of all the elements has a 'page-break-inside' value of 'avoid', then breaking here is not allowed.
Rule C: Breaking at (2) is allowed only if the number of line boxes between the break and the start of the enclosing block box is the value of 'orphans' or more, and the number of line boxes between the break and the end of the box is the value of 'widows' or more.
Rule D: breaking at (2) is allowed only if the 'page-break-inside' property is 'auto'.
If the above doesn't provide enough break points to keep content from overflowing the page boxes, then rules A, B and D are dropped in order to find additional breakpoints.
If that still does not lead to sufficient break points, rule C is dropped as well, to find still more break points.
A page break MUST occur at (1) if, among the 'page-break-after' and 'page-break-before' properties of all the elements generating boxes that meet at this margin, there is at least one with the value 'always', 'left', or 'right'.
When multiple 'page-break-before' and/or 'page-break-after' properties with values of "always", "left" or "right" apply at a margin, only one of them should generate page breaks. That is, no Content-empty pages are generated by page-break properties, except for at most one Content-empty page as may be required by :right and :left values to position ensuing content on a right- or left-facing page.
A page break MUST also occur at (1) if the last line box above this margin and the first one below it do not have the same value for 'page'.
Value: auto | intrinsic | <angle>
Initial: auto
Inherited:N/A
Media: visual
Computed value: specified value modulo full circle value
CSS layout processing applies to the image after rotation. This implies, for example:
- The intrinsic height and width are derived from the rotated rather than the original image dimensions
- The height (width) property applies to the vertical (horizontal) dimension of the image, after rotation.
auto: The image will be set to the orientation of the page
intrinsic: The image will be oriented according to orientation metadata contained within the image source data.
If no such metadata is found, the image is oriented as for 'auto'.
A value of '0deg' orients the image as for 'auto'.
A positive value rotates the image to the right (in a clockwise direction) by the given number of degrees.
Negative values rotate to the left or in a counter-clockwise direction.
Value: fill | contain | cover
Initial: fill
Applies to: replaced elements
Inherited: yes
Media: visual
fill: Determine the used 'height' and 'width' as usual.
fill: Scale the content height and width independently so that the edges of the content just meet the edges of the box established by the used 'height' and 'width'.
contain: Determine the used 'height' and 'width' as usual, except if both 'height' and 'width' are 'auto', and the used value of at least one of 'max-width' and 'max-height' is not 'none', then compute the element's used width and used height as though the intrinsic dimensions of the contents were infinitely large numbers whose ratio is the actual intrinsic ratio of the contents.
contain: Scale the contents of the element, preserving their aspect ratio, to the largest size such that the width of the contents is less than or equal to the used width of the box and the height of the contents is less than or equal to the used height of the box.
Determine the used 'height' and 'width' as usual, except if both 'height' and 'width' are 'auto', and the used value of at least one of 'min-width' and 'min-height' is not '0', then compute the used width and used height of the element as though the intrinsic dimensions of the contents were infinitesimally small numbers whose ratio is the actual intrinsic ratio of the contents.
Scale the contents of the element, preserving their aspect ratio, to the smallest size such that the width of the contents is greater than or equal to the used width of the box and the height of the contents is greater than or equal to the height of the box.
The 'overflow' property determines how to render parts of the replaced element's content that extend beyond the edges of its box.
Value: [ [ <percentage> | <length> | left | center | right ] [ <percentage> | <length> | top | center | bottom ]? ] | [ [ left | center | right ] || [ top | center | bottom ] ] | auto
Initial: 50% 50%
Applies to: replaced elements
Inherited: yes
Media: visual
See background-position for a detailed description of values other than 'auto'.
If two values are given, the horizontal position comes first. (CSS2.1:14.2.1)
See background-position for a detailed description of values other than 'auto'.
If only one percentage or length value is given, it sets the horizontal position only, and the vertical position will be 50%. (CSS2.1:14.2.1)
With a value pair of '0% 0%', the upper left corner of the image is aligned with the upper left corner of the box's padding edge. A value pair of '100% 100%' places the lower right corner of the image in the lower right corner of padding area. With a value pair of '14% 84%', the point 14% across and 84% down the image is to be placed at the point 14% across and 84% down the padding area.
With a value pair of '0% 0%', the upper left corner of the image is aligned with the upper left corner of the box's padding edge. A value pair of '100% 100%' places the lower right corner of the image in the lower right corner of padding area. With a value pair of '14% 84%', the point 14% across and 84% down the image is to be placed at the point 14% across and 84% down the padding area.
With a value pair of '2cm 2cm', the upper left corner of the image is placed 2cm to the right and 2cm below the upper left corner of the padding area.
With a value pair of '2cm 2cm', the upper left corner of the image is placed 2cm to the right and 2cm below the upper left corner of the padding area.
'top left', 'left top': Same as '0% 0%'. 'top', 'top center', 'center top': Same as '50% 0%'. 'right top', 'top right': Same as '100% 0%'.
'top left', 'left top': Same as '0% 0%'. 'left', 'left center', 'center left': Same as '0% 50%'. 'bottom left', 'left bottom': Same as '0% 100%'.
'top', 'top center', 'center top': Same as '50% 0%'. 'left', 'left center', 'center left': Same as '0% 50%'. 'center', 'center center': Same as '50% 50%'. 'center', 'center center': Same as '50% 50%'. 'bottom', 'bottom center', 'center bottom': Same as '50% 100%'.