Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.
This module introduces logical properties and values that provide the author with the ability to control layout through logical, rather than physical, direction and dimension mappings. The module defines logical properties and values for the features defined in [CSS21]. These properties are writing-mode relative equivalents of their corresponding physical properties.
CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, in speech, etc.This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.
The (archived) public mailing list www-style@w3.org (see instructions) is preferred for discussion of this specification. When sending e-mail, please put the text “css-logical-props” in the subject, preferably like this: “[css-logical-props] …summary of comment…”
This document was produced by the CSS Working Group (part of the Style Activity).
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
Properties that accept physical directional keyword values (top, bottom, left, or right) are redefined to also accept the appropriate logical directional keywords (before, after, start, or end). In such cases, the logical values can be used in place of the corresponding physical values. For properties that take multiple keywords, combinations of logical and physical values are not allowed.
The following properties accept the start and end keywords where left and right are allowed:
caption-side)
The following properties accept the before and after keywords where
top and bottom are allowed:See the section on Abstract Layout details on how to map between logical and physical terms. This mapping controls the interpretation of logical keywords.
float needs coordination with GCPM where it defines page floats
resize accepts horizontal and vertical, and these terminologies should be physical. should we add 'resize-x and resize-y' as logical values?
In CSS, all pages are classified by user agents as either left pages or right pages. [CSS21] Which page is first in a spread, however, depends on whether the page progression is left-to-right or right-to-left.
To allow control of page breaking to the page that is on the earlier or later side of a spread, rather than to the left or right side of a spread, this module introduces the following additional keywords for the page-break-after and page-break-before properties [CSS21]:
recto/verso or even/odd or even-page/odd-page? If using odd/even, could use "The page number used to determine whether a page is even or odd is the physical page count starting from 1, and is sometimes different from the page number printed on the page. In other words, if a page is on the same side as the first page, it is an odd page." But which side would we want if page-break-before changes the first page?
Logical page selectors are added to support logical page selection. Authors typically place page numbers using physical placements, but the contents of headers often follows conventions depending on which page in the spread is earlier.
Following page selectors are added to support this scenario:
The logical page selectors have specificity equal to the ':left' and ':right' page selectors.
| Name: | measure, length |
|---|---|
| Value: | length | percentage | auto |
| Initial: | auto |
| Applies to: | same as width and height |
| Inherited: | no |
| Media: | visual |
| Computed value: | the percentage as specified or the absolute length or auto (see text) |
| Percentages: | measure, length of containing block |
These properties correspond to the width and height properties. The mapping depends on the element’s writing-mode.
| Name: | min-measure, min-length |
|---|---|
| Value: | length | percentage |
| Initial: | 0 |
| Applies to: | same as width and height |
| Inherited: | no |
| Media: | visual |
| Computed value: | the percentage as specified or the absolute length (see text) |
| Percentages: | measure, length of containing block |
These properties correspond to the max-width and max-height properties. The mapping depends on the element’s writing-mode.
| Name: | max-measure, max-length |
|---|---|
| Value: | length | percentage | none |
| Initial: | none |
| Applies to: | same as width and height |
| Inherited: | no |
| Media: | visual |
| Computed value: | the percentage as specified or the absolute length or none (see text) |
| Percentages: | measure, length of containing block |
These properties correspond to the min-width and min-height properties. The mapping depends on the element’s writing-mode.
| Name: | margin-before, margin-after, margin-start, margin-end |
|---|---|
| Value: | length | percentage | auto |
| Initial: | 0 |
| Applies to: | same as margin |
| Inherited: | no |
| Media: | visual |
| Computed value: | the percentage as specified or the absolute length or auto (see text) |
| Percentages: | logical-width of containing block |
These properties correspond to the margin-top, margin-bottom, margin-left, and margin-right properties. The mapping depends on the parent element’s writing-mode, direction, and text-orientation.
| Name: | offset-before, offset-after, offset-start, offset-end |
|---|---|
| Value: | length | percentage | auto |
| Initial: | auto |
| Applies to: | positioned elements |
| Inherited: | no |
| Media: | visual |
| Computed value: | same as box offsets: top, right, bottom, left properties except that directions are logical |
| Percentages: | logical-width, resp. logical-height of containing block |
These properties correspond to the top, bottom, left, and right properties. The mapping depends on the parent element’s writing-mode, direction, and text-orientation.
| Name: | padding-before, padding-after, padding-start, padding-end |
|---|---|
| Value: | length | percentage |
| Initial: | 0 |
| Applies to: | all elements |
| Inherited: | no |
| Media: | visual |
| Computed value: | length (see text) |
| Percentages: | logical-width of containing block |
These properties correspond to the padding-top, padding-bottom, padding-left, and padding-right properties. The mapping depends on the element’s writing-mode, direction, and text-orientation.
These properties correspond to the border-top-width, border-bottom-width, border-left-width, and border-right-width properties. The mapping depends on the element’s writing-mode, direction, and text-orientation.
These properties correspond to the border-top-style, border-bottom-style, border-left-style, and border-right-style properties. The mapping depends on the element’s writing-mode, direction, and text-orientation.
These properties correspond to the border-top-color, border-bottom-color, border-left-color, and border-right-color properties. The mapping depends on the element’s writing-mode, direction, and text-orientation.
| Name: | border-before, border-after, border-start, border-end |
|---|---|
| Value: | border-width || border-style || color |
| Initial: | (see individual properties) |
| Applies to: | all elements |
| Inherited: | no |
| Media: | visual |
| Computed value: | see individual properties |
| Percentages: | see individual properties |
These properties correspond to the border-top, border-bottom, border-left, and border-right properties. The mapping depends on the element’s writing-mode, direction, and text-orientation.
The shorthand properties for margin, padding, and border set values for physical properties by default. But authors can specify the logical keyword at the beginning of the property value to indicate that the values map to the logical properties instead of the physical ones.
other candidates of the keyword are: relative, script, writing-mode, beas, or the value itself (e.g., vertical-lr-ltr)
The following [CSS21] shorthand properties accept the logical keyword:
The syntax for these properties is effectively changed by replacing
<value-type>{1,4}
with
logical? <value-type>{1,4}
When the logical keyword is present in the value, the values that follow are assigned to the logical properties as follows:
Should the shorthand also reset the physical properties to their initial values?
blockquote {
margin: logical 1em 2em 3em 4em;
}
blockquote {
margin-before: 1em;
margin-end: 2em;
margin-after: 3em;
margin-start: 4em;
}
[CSS3BG] is handled separately because it can fill an area with specified images, and the area to fill can be rotated or flipped depending on the text flow.
| Name: | background-image-transform |
|---|---|
| Value: | logical | physical | rotate |
| Initial: | physical |
| Applies to: | all elements |
| Inherited: | yes |
| Media: | visual |
| Computed value: | as specified |
| Percentages: | n/a |
is this the right default? we need to investigate which is more common
This property defines whether background images are transformed to match to the value of writing-mode property, and whether background-size widths and heights are logical or physical. Values have the following meanings:
The repeat-x and repeat-y values are logical, but in CSS3 this property can also accept double values to specify horizontal and vertical behaviors separately. The double values are considered logical if the logical keyword is specified, otherwise physical.
should also add repeat-horizontal and repeat-vertical for the physical value?
| Name: | border-image-transform |
|---|---|
| Value: | logical | physical | rotate |
| Initial: | rotate |
| Applies to: | All elements, except internal table elements when border-collapse is collapse |
| Inherited: | yes |
| Media: | visual |
| Computed value: | as specified |
| Percentages: | n/a |
is this the right initial default?
This property defines whether border images are transformed to match to the value of writing-mode property, with the reference writing mode being writing-mode: horizontal-tb; direction: ltr. Values have the following meanings:
The following properties use the value of this property to determine how directional mappings are done:
Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.
All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]
Examples in this specification are introduced with the words "for example"
or are set apart from the normative text with class="example",
like this:
This is an example of an informative example.
Informative notes begin with the word "Note" and are set apart from the
normative text with class="note", like this:
Note, this is an informative note.
Advisements are normative sections styled to evoke special attention and are
set apart from other normative text with <strong class="advisement">, like
this:
UAs MUST provide an accessible alternative.
Conformance to this specification is defined for three conformance classes:
A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.
A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)
An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.
So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.
To avoid clashes with future CSS features, the CSS2.1 specification reserves a prefixed syntax for proprietary and experimental extensions to CSS.
Prior to a specification reaching the Candidate Recommendation stage in the W3C process, all implementations of a CSS feature are considered experimental. The CSS Working Group recommends that implementations use a vendor-prefixed syntax for such features, including those in W3C Working Drafts. This avoids incompatibilities with future changes in the draft.
Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec.
To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.
Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.
| Name | Value | Initial | Applies to | Inh. | %ages | Media | Computed value |
|---|---|---|---|---|---|---|---|
| measure | length | percentage | auto | auto | same as width and height | no | measure, length of containing block | visual | the percentage as specified or the absolute length or auto (see text) |
| length | length | percentage | auto | auto | same as width and height | no | measure, length of containing block | visual | the percentage as specified or the absolute length or auto (see text) |
| min-measure | length | percentage | 0 | same as width and height | no | measure, length of containing block | visual | the percentage as specified or the absolute length (see text) |
| min-length | length | percentage | 0 | same as width and height | no | measure, length of containing block | visual | the percentage as specified or the absolute length (see text) |
| max-measure | length | percentage | none | none | same as width and height | no | measure, length of containing block | visual | the percentage as specified or the absolute length or none (see text) |
| max-length | length | percentage | none | none | same as width and height | no | measure, length of containing block | visual | the percentage as specified or the absolute length or none (see text) |
| margin-before | length | percentage | auto | 0 | same as margin | no | logical-width of containing block | visual | the percentage as specified or the absolute length or auto (see text) |
| margin-after | length | percentage | auto | 0 | same as margin | no | logical-width of containing block | visual | the percentage as specified or the absolute length or auto (see text) |
| margin-start | length | percentage | auto | 0 | same as margin | no | logical-width of containing block | visual | the percentage as specified or the absolute length or auto (see text) |
| margin-end | length | percentage | auto | 0 | same as margin | no | logical-width of containing block | visual | the percentage as specified or the absolute length or auto (see text) |
| offset-before | length | percentage | auto | auto | positioned elements | no | logical-width, resp. logical-height of containing block | visual | same as box offsets: top, right, bottom, left properties except that directions are logical |
| offset-after | length | percentage | auto | auto | positioned elements | no | logical-width, resp. logical-height of containing block | visual | same as box offsets: top, right, bottom, left properties except that directions are logical |
| offset-start | length | percentage | auto | auto | positioned elements | no | logical-width, resp. logical-height of containing block | visual | same as box offsets: top, right, bottom, left properties except that directions are logical |
| offset-end | length | percentage | auto | auto | positioned elements | no | logical-width, resp. logical-height of containing block | visual | same as box offsets: top, right, bottom, left properties except that directions are logical |
| padding-before | length | percentage | 0 | all elements | no | logical-width of containing block | visual | length (see text) |
| padding-after | length | percentage | 0 | all elements | no | logical-width of containing block | visual | length (see text) |
| padding-start | length | percentage | 0 | all elements | no | logical-width of containing block | visual | length (see text) |
| padding-end | length | percentage | 0 | all elements | no | logical-width of containing block | visual | length (see text) |
| border-before-width | border-width | medium | all elements | no | logical-width of containing block | visual | absolute length; 0 if the border style is none or hidden (see text) |
| border-after-width | border-width | medium | all elements | no | logical-width of containing block | visual | absolute length; 0 if the border style is none or hidden (see text) |
| border-start-width | border-width | medium | all elements | no | logical-width of containing block | visual | absolute length; 0 if the border style is none or hidden (see text) |
| border-end-width | border-width | medium | all elements | no | logical-width of containing block | visual | absolute length; 0 if the border style is none or hidden (see text) |
| border-before-style | border-style | none | all elements | no | n/a | visual | specified value (see text) |
| border-after-style | border-style | none | all elements | no | n/a | visual | specified value (see text) |
| border-start-style | border-style | none | all elements | no | n/a | visual | specified value (see text) |
| border-end-style | border-style | none | all elements | no | n/a | visual | specified value (see text) |
| border-before-color | color | currentcolor | all elements | no | n/a | visual | computed color (see text) |
| border-after-color | color | currentcolor | all elements | no | n/a | visual | computed color (see text) |
| border-start-color | color | currentcolor | all elements | no | n/a | visual | computed color (see text) |
| border-end-color | color | currentcolor | all elements | no | n/a | visual | computed color (see text) |
| border-before | border-width || border-style || color | (see individual properties) | all elements | no | see individual properties | visual | see individual properties |
| border-after | border-width || border-style || color | (see individual properties) | all elements | no | see individual properties | visual | see individual properties |
| border-start | border-width || border-style || color | (see individual properties) | all elements | no | see individual properties | visual | see individual properties |
| border-end | border-width || border-style || color | (see individual properties) | all elements | no | see individual properties | visual | see individual properties |
| background-image-transform | logical | physical | rotate | physical | all elements | yes | n/a | visual | as specified |
| border-image-transform | logical | physical | rotate | rotate | All elements, except internal table elements when border-collapse is collapse | yes | n/a | visual | as specified |