This module extends the CSS sizing properties with keywords that represent content-based "intrinsic" sizes and context-based "extrinsic" sizes, allowing CSS to more easily describe boxes that fit their content or fit into a particular layout context. 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 email@example.com (see instructions) is preferred for discussion of this specification. When sending e-mail, please put the text “css-sizing” in the subject, preferably like this: “[css-sizing] …summary of comment…”
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.
This section is not normative.
CSS layout has several different concepts of automatic sizing that are used in various layout calculations. This section defines some more precise terminology to help connect the layout behaviors of this spec to the calculations used in other modules, and some new keywords for the width and height properties to allow authors to assign elements the dimensions resulting from these size calculations.
This module extends the width, height, min-width, min-height, max-width, max-height, and column-width features defined in [CSS21] chapter 10 and in [CSS3COL]
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.
Note: This is the formula used to calculate the auto widths of non-replaced blocks in normal flow in CSS2.1§10.3.3.
Note: This is called the “available width” in CSS2.1§10.3.5 and computed by the rules in CSS2.1§10.3.3.
Note: This is called the “preferred width” in CSS2.1§10.3.5 and the “maximum cell width” in CSS2.1§184.108.40.206.
Note: This is called the “preferred minimum width” in CSS2.1§10.3.5 and the “minimum content width” in CSS2.1§220.127.116.11.
min(preferred measure, max(min-content measure, fill-available measure)). Otherwise, equal to the max-content measure.
Note: This is called the “shrink-to-fit” width in CSS2.1§10.3.5 and CSS Multi-column Layout § 3.4.
Or should this be the minimum between allowed break points? It might make sense in multi-col contexts to have min-content and max-content extents be different, even if they are the same elsewhere.
Same issue as min-content extent.
|Name:||width, min-width, max-width, height, min-height, max-height|
|New values:||fill | max-content | min-content | fit-content|
There are four types of automatically-determined sizes in CSS (which are represented in the width and height properties by the keywords defined above):
Does this value work? Is it needed?
Right now all of these except fill mean the same thing for extents. This may or may not be ideal.
If the measure is auto, we could have min-content extent imply a max-content measure, and vice versa.
Note that percentages resolved against the intrinsic sizes (max-content, min-content, fit-content, repudiate-floats) will compute to auto, as defined by CSS 2.1. [CSS21]
|New values:||fill | max-content | min-content | fit-content|
When used as values for column-width, the new keywords specify the optimal column width:
min(max-content measure, max(min-content measure, fill-available measure)).
Intrinsic sizing determines sizes based on the contents of an element, without regard for its context.
For replaced elements, the min-content size and max-content size are equivalent and correspond to the appropriate dimension of the concrete object size returned by the default sizing algorithm [CSS3-IMAGES] of the element, calculated with an unconstrained specified size.
The min-content measure of an inline box is the length of the largest unbreakable sequence of inline content. The min-measure contribution of an inline box is its min-content measure, plus any inline-axis margin, border, and padding adjacent to that sequence.
The max-content measure of an inline box is the length of the largest sequence of inline content on a single line when only forced line breaks are taken. The max-measure contribution of an inline box is its max-content measure, plus any inline-axis margin, border, and padding adjacent to that sequence.
The min-content extent, max-content extent, min-extent contribution, and max-extent contribution of an inline box are the distance from the head edge of the first line box to the foot edge of the last line box on which the inline appears.
The min-content measure of a block container box is the largest min-measure contribution of its in-flow or floated children.
The max-content measure of a block container box is the measure of the box after layout, if all children are sized under a max-size constraint.
If the computed measure of a block-level box is min-content, max-content, or a definite size, its min-measure contribution is that size plus any inline-axis margin, border, and padding. Otherwise, if the computed measure of the block is fit-content, auto, or fill, its min-measure contribution is its min-content measure plus any inline-axis margin, border, and padding.
If the computed measure of a block-level box is min-content, max-content, or a definite size, its max-measure contribution is that size plus any inline-axis margin, border, and padding. Otherwise, if the computed measure of the block is fit-content, auto, or fill, its max-measure contribution is its max-content measure plus any inline-axis margin, border, and padding.
The min-content extent and max-content extent of a block container box is the content extent as defined (for horizontal writing modes) in CSS2.1§10.6.3 and CSS2.1§17.5.3 for elements with height: auto, and analogously for vertical writing modes.
The min-extent contribution and max-extent contribution of a block-level box is the extent of the block after layout, plus any block-axis margin, border, and padding.
The min-content measure of a multi-column element with a computed column-width not auto is the smaller of its column-width and the largest min-measure contribution of its contents.
The min-content measure of a multi-column element with a computed column-width of auto is the largest min-measure contribution of its contents multiplied by its column-count (treating auto as 1).
The max-content measure of a multi-column element with unrestrained column heights and a computed column-count not auto is its column-count multiplied by the larger of its column-width (treating auto as 0) and the largest max-measure contribution of its contents.
The max-content measure of a multi-column element with unrestrained column heights and a computed column-count of auto is its column-width multiplied by the number of columns obtained by taking all allowed column breaks [CSS3-BREAK].
The max-content measure of a multi-column element with restrained-height columns (i.e. a specified height or max-height, or whichever properties map to the extent of the element) is the measure that would exactly include all of its columns. It may be approximated by:
or by some more accurate method.
This approximation can result in some slack, but avoids overflow in the most common cases, where the balanced height of the columns above spanning elements are approximately equal.
In the common case of no column-spanning elements, this approximation collapses to simply doing a layout, and measuring the resulting columns.
The preferred measure of a multi-column element with non-auto column-width and column-count is the product of the column-width and column-count, plus the appropriate amount of column gaps. In all other cases, it is the max-content measure.
Extrinsic sizing determines sizes based on the context of an element, without regard for its contents.
The inner fill-available measure of a box is…
max(min-measure|0, min(max-measure|infinity, measure|fill-available measure))where the sizes are inner measures of the element establishing the box’s containing block, and where the first value is used if it is definite and the second value otherwise.
…less the box’s inline-axis margins (after any margin collapsing, and treating auto margins as zero), borders, and padding.
The fill-available extent of a box is defined analogously, but in the other dimension.
This definition might end up skipping further up the ancestor chain than we’d like in some cases. Example. Maybe it should stop at each formatting root, or something similar?
Special thanks go to Aaron Gustafson, L. David Baron for their contributions to this module.
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
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 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 firstname.lastname@example.org mailing list.
No properties defined.
Or should this be the minimum between allowed break points? It might make sense in multi-col contexts to have min-content and max-content extents be different, even if they are the same elsewhere. ↵Less stupid name? ↵
Does this value work? Is it needed? ↵
If the measure is auto, we could have min-content extent imply a max-content measure, and vice versa. ↵