Skip to content

[CSS2] Clarify how the root element is laid out. #6480

Closed

Description

@Alohci

CSS 2.2 Section 9.3 says that the root element is out-of-flow. CSS-Display's (convenience) Glossary definition of out-of-flow does not mention the root element.

Sometimes the root element is treated like it's out-of-flow, e.g. by default, its box contains its floats, showing that it establishes a BFC (2.2 Section 10.6.7) although from (2.2 Section 9.4.1) it's not clear why. The only clause which could fit is "block containers that are not block boxes". It's definitely by default a block container, so for it not to be a block box, it would have to be not block-level. Which is possible if the initial containing block doesn't establish a BFC, . (I can't find any CSS spec that says anything about this), since only a box that participates in a BFC can be block-level (2.2 Section 9.2.1)

On the other hand, for the calculations of the widths and heights, the root element's box is treated according to the rules of Block-level, non-replaced elements in normal flow (2.2 Sections 10.3.3 & 10.6.3).

I think 10.3.3. and 10.6.3 definition should be extended to make clear that they apply to the root element.

Activity

  1. cvrebert commented on Sep 24, 2022

    @cvrebert
    Member

    See also #1599, which is about clarifying that the root element is in-flow in CSS2 .1

  2. fantasai commented on Dec 7, 2022

    @fantasai
    Collaborator

    OK, we've clarified that the ICB is establishes a block formatting context, and that the root box establishes an independent formatting context. This should make the root element's layout fully defined. The main open question is whether the root should also be allowed to float -- there's no reason for it not to be able to, but some implementations don't handle it, see discussion in #7207

  3. fantasai commented on Dec 7, 2022

    @fantasai
    Collaborator

    Closing out the issue, let me know if anything seems to still be a problem. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions