Table of Contents

CSS Box Module Level 3

The goals of the CSS3 Box spec are to rewrite the CSS2.1 box model such that it is:

This page is to track specifically the remaining work on the CSS Box module. Please post issues to www-style first for discussion, then add a summary and a link to the discussion and/or any key messages below.

General Problems to Solve

This section is for describing general problems that the CSS Box module must solve, e.g. concepts that need defining or refining, or spec areas that should be rewritten to improve clarity.

Property transfer from elements to boxes

CSS21 is clear that properties belong to elements, not boxes, but they cause boxes to be have in certain ways.

In reality, though, everyone talks about properties on boxes, and so the css3-box spec currently says that “we refer interchangeably to “the P property of an element” and “the P property of a box” (both of which actually mean “the value of property P of…”), unless it is important to distinguish the box and the element, e.g., because the element has several boxes and they don't all have the same value for the property”. Unfortunately this doesn't really work, though, because it's necessary (or at least very desirable, editorially) to be able to be able to identify boxes by their properties, and that's not possible unless there's a clearly defined way of transferring properties from an element to its boxes in the case that an element generates multiple boxes.

A better approach is to formalize the use of properties on boxes. Current thinking:

NOTE: check out css3-page where properties are assigned from page context and margin context to boxes; need to align

NOTE: how does this work for box fragments?

Containing blocks

We have seen frequent cases of spec authors using incorrect terminology or awkward constructions when referring to containing blocks, due to the lack of clarity and suitable hooks in CSS21:

Problem: a containing block is a rectangle, not an element or box
Problem: a containing block is associated to a box, not to an element
Problem: a containing block is established by a box, not by an element

Problem: not every rectangle that could potentially be a containing block for some box is actually a containing block for an actual box in the formatting structure

Problem: difficulty in inserting new rules to modify how the containing block of a box with particular properties is determined

Problem: difficulty in restricting attention to only those boxes for whom the container will establish the containing block
Problem: difficulty in removing boxes from the set of potential containing block–establishing boxes for a given kind of box.

Note: need to incorporate extensions specified in the positioning spec

Anonymous boxes

What, really, is an anonymous box? There currently seem to be two rather different interpretations:

Potential candidates for "anonymous" status

Relevant quotes

From CSS21:

From css3-images:

Observations

Current thinking

Technically, I think it's unnecessary to identify “anonymous boxes” on the basis of how properties are distributed. Properties are set on elements, and elements generate boxes based on its properties and on the formatting context in which its contents participate. How an element imparts its properties to the boxes that it generates is the business of that element, and I don't see that we need a special term to describe a box whose property values all arise in some particular way. For example, I see no difference between the way that a table element distributes its property values between the wrapper box and the table box and the way that a block element distributes its properties to a so-called anonymous box; inheritable properties are inherited down the box tree (although CSS doesn't state that explicitly anywhere) and non-inheritable properties get their values from somewhere as defined by the element “type”.

If the definition of principal box is modified so that an inline element generates a principal box (possibly fragmented across multiple line boxes), then perhaps we can define an anonymous box to be any box which is not a principal box. In that case, “derived box” might be a better term since such a box might not be anonymous in the sense that there may well exist a selector which can directly address some properties of that box (eg table element selector which addresses the table box, list item selector which addresses the marker box or even a ::marker pseudo-element).

Editorially, it's be helpful to have a name for “fix-up boxes” introduced into the formatting structure in order to ensure that the rules of each formatting context are met. Perhaps the term “anonymous box” could be used for this purpose? Need to define fix-up box: perhaps say that it's a box which cannot be distinguished by its property values and characteristics from a box generated by some hypothetical document element. Implications: column boxes and probably certain ruby boxes would *not* be anonymous, since no hypothetical document element could create them. A misparented table cell can result in the creation of an anonymous/fix-up table wrapper box, but is it reasonable to call the table box anonymous? Is the table box a fix-up, really, or is the wrapper box the fix up and the table box the natural consequence of the wrapper box?

My preferred approach is currently to equate anonymous boxes with “fix-up boxes” as just described.

Flow roots, flows and formatting contexts

CSS has “normal flow”, “in-flow” and “out of flow”, but never really explains what the/a normal flow is. It's reasonably clear about what a flow is though.

Relevant quotes for flow

From CSS21:

From css3-break:

Fros css3-regions:

[Note: css3-page 9.4 (Allowed page breaks) says: “In the normal flow, page breaks may occur at the following places”. What does this mean? Does this indicate that a nested flow root may be fragmented if its its in-flow content has page break opportunities as specified? Or is it trying to say that page break opportunities only exist in the outermost flow (whatever that actually is)?]

[Note: according to CSS21 9.3, the root element is out of flow. Is this correct? Surely it participates in the block formatting context established by the initial containing block.]

Relevant quotes for formatting contexts

From flexbox:

From multicol:

From exclusions:

From writing-modes:

From regions:

Current thinking

Formatting contexts are established by (possibly anonymous) boxes which may or may not be flow roots, whilst a flow root necessarily establishes a formatting context of some kind, depending on the box's properties.

A flow root is roughly a box whose normal flow is rendered in a location that's out-of-sync with the normal flow content that surrounds the flow root's box in the box tree. I'm not yet clear whether its even necessary to care about the concept of flow root. The more obviously important concept is that of formatting context.

Column boxes establish column formatting contexts which are currently identical in behaviour to block formatting contexts. (In future, column formatting contexts might allow the overflow of a float from a previous column to affect the block formatting of the column in which the overflow sits. Perhaps 'clear' will react to that float overflow too.)

Recall that the scope of float behaviour and clearance behaviour is restricted to the block formatting context in which the float and clearing element participates.

Interesting note: no flow root can ever establish an inline formatting context, because inline formatting contexts can only exist inside of another non-inline formatting context. This is because inline formatting contexts may contain floats, and how those floats behave depends on the outer formatting context. If the outer formatting context is a BFC then the float floats, though it's not clear where its box belongs in the box tree. If the outer formatting context is something else (and no examples exist of this yet in CSS) then whether and how the float floats is up to that formatting context.

Random note: block formatting contexts are not concerned merely with the formatting of block-level elements. They're also concerned with the formatting of floats and of list marker boxes. Of course, if such things are defined to be block-level then semantically there's no issue… but the description of block-level formatting needs to make reference to these things, even if it leaves the details to other specs.

Random note: each formatting context needs to explain how to resolve the battle between a child's intrinsic size and extrinsic size.

Spec Issues

This section is for listing errors in the spec and mismatches against CSS2.1.