Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This module contains the features of CSS relating to avoiding collisions between layout boxes.. 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 “www-style” in the subject, preferably like this: “[www-style] …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.
collision
’ property
This section is not normative.
CSS provides several layout mechanisms, allowing authors to position their content in various ways. In some cases, the instructions given by the author may cause several parts of the document to overlap, making the content unreadable. Viewing the document in an environment significantly different from the one the author expected may increase the chances of such overlap happening. This module introduces an collision avoidance mechanism that authors can use in such situations.
Explain, normatively, how this module affects the definition of CSS.
This module replaces and extends the SUMMARIZE HERE features defined in [CSS21] sections W.X and Y.Z.
All properties in this module apply to the
::first-line
and ::first-letter
pseudo-elements.
This specification follows the CSS property definition conventions from [CSS21]. Value types not defined in this specification are defined in CSS Level 2 Revision 1 [CSS21]. Other CSS modules may expand the definitions of these value types: for example [CSS3COLOR], when combined with this module, expands the definition of the <color> value type as used in this specification.
In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the inherit keyword as their property value. For readability it has not been repeated explicitly.
collision
’ propertyName: | collision |
---|---|
Value: | auto | allow | avoid |
Initial: | auto |
Applies to: | all elements |
Inherited: | no |
Percentages: | N/A |
Media: | visual |
Computed value: | See prose |
Animatable: | no |
The computed value of ‘auto
’ is ‘allow
’ except when at least one of the following
two conditions are matched:
float
’
property is not ‘none
’
wrap-flow
’
property is not ‘auto
’
Unless specified otherwise for a particular layout mode, two elements are said to overlap when their margin boxes intersect.
If two elements which both have a computed value of ‘avoid
’ overlap each other when positioned
according to the normal rules of their respective positioning schemes, the
later one in document order is repositioned so that it no longer overlap
with any other element preceding it in document order whose ‘collision
’ property also
compute to ‘avoid
’ . If this repositioning
causes the element to overlap with element later in document order whose
‘collision
’ property
compute to ‘avoid
’, then these later
elements must also me moved. The precise way the elements are repositioned
depends on their respective layout mechanisms, as listed in the following
sections.
On elements where the ‘float
’ property
computes to something else than ‘none
’,
the collision avoiding behavior is the historical one, as described in
insert reference.
Write some prose to describe what happens with floats and collision:allow. The idea is that if a wide float:left containing xxxxxxx collides with narrow one containing ......... we will get this:
... ... ...xx ...xx xxxxx xxxxx
We define 4 types of repositioning movements, and then indicate in which case each is used.
Determine the element's writing mode, to identify which of the top/right/bottom/left properties correspond to the head/end/foot/start directions. Then, based on which of these is set to auto or to another value, pick a movement:
start | end | head | foot | Movement |
auto | auto | auto | auto | C |
auto | auto | auto | C | |
auto | auto | auto | C | |
auto | auto | C | ||
auto | auto | auto | C | |
auto | auto | C | ||
auto | auto | C | ||
auto | C | |||
auto | auto | auto | D | |
auto | auto | D | ||
auto | auto | D | ||
auto | D | |||
auto | auto | A | ||
auto | A | |||
auto | B | |||
C |
While the above table of movements should cover a majority of use
cases, there is another set of movements that may be worth considering,
which are more analogus to what floats do when the clear property is set
to ‘none
’. With the 4 extra movements
defined below, an alternative table of movements can be established. It
is tempting to use the existing ‘clear
’
property, maybe with new additional values to make chose between one set
of behavior and the other, but I am not convinced it is possible while
conserving compatibility and sanity. When introducing a property to opt
in the behavior described below, we have the option of making the switch
for all cases simultaneously, or having more fine grained control,
enabling the alternative behavior 1 line at a time.
We then have the following mapping, when the opt-in property does not apply. The rows marked with * are different from the previous table.
start | end | head | foot | Movement |
auto | auto | auto | auto | E* |
auto | auto | auto | E* | |
auto | auto | auto | F* | |
auto | auto | C | ||
auto | auto | auto | C | |
auto | auto | E* | ||
auto | auto | F* | ||
auto | C | |||
auto | auto | auto | D | |
auto | auto | G* | ||
auto | auto | H* | ||
auto | D | |||
auto | auto | A | ||
auto | A | |||
auto | B | |||
E* |
needs formal description. In case of collision, the text inside the line box is what gets moved forward, to avoid overlapping. This needs a special definition of collisions, as this isn't based on the margin box.
In flow block boxes avoid collisions by being moved forward in the block progression direction until they no longer overlap. This move is similar to increasing the size of their top margin. This does not or does it? influence the computed or used value of the margin-top property.
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.
Conformance to CSS Collision Level 3 is defined for three conformance classes:
A style sheet is conformant to CSS Collision Level 3 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 CSS Collision Level 3 if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by CSS Collision Level 3 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 CSS Collision Level 3 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.
[Change or remove the following CR exit criteria if the spec is not a module, but, e.g., a Note or a profile. This text was decided on 2008-06-04.]
For this specification to be advanced to Proposed Recommendation, there must be at least two independent, interoperable implementations of each feature. Each feature may be implemented by a different set of products, there is no requirement that all features be implemented by a single product. For the purposes of this criterion, we define the following terms:
The specification will remain Candidate Recommendation for at least six months.
Feeback and comments from the following people have helped improve this specification:
Property | Values | Initial | Applies to | Inh. | Percentages | Media |
---|---|---|---|---|---|---|
collision | auto | allow | avoid | auto | all elements | no | N/A | visual |