GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing drafts.csswg.org — CSS Positioned Layout Module Level 4 1. IntroductionThis is an early delta spec over [css-position-3]. 2. Scrollable Containing BlockWhen a scroll container establishes an absolute positioning containing block for an absolutely positioned box, one of three possible containing blocks are used:
Note: While all of these are in some sense corresponding to the padding box, they do not coincide for boxes with scrollable overflow. Figure out the exact concepts needed for top layer. They probably want to do something a tiny bit different, specific to their layer. Unless otherwise specified, absolutely positioned boxes use the local containing block. Certain CSS features can specify a different containing block. For example, fixed-positioned boxes typically use the document’s fixed containing block, and position-area values other than none can opt absolutely positioned boxes into the scrollable containing block. Note: There is not currently any way to refer to a fixed containing block other than the fixed positioning containing block, but one might be added in the future. 3. Top Layer
Note: This special rendering behavior ensures that elements in the top layer cannot be clipped by anything in the document, or obscured by anything except elements later in the top layer. This ensures that things like popovers can be displayed reliably, regardless of what their ancestor elements might be doing. The top layer root of an element is its nearest ancestor element that is in the top layer, or none otherwise (in which case it’s painted as part of the document as normal). Two elements are in the same top layer if they have the same top layer root (including if both are none). An element A is in a higher top layer than an element B if A has a top layer root, and either B has a top layer root earlier in the top layer than A’s, or B doesn’t have a top layer root at all. Note: The top layer is managed entirely by the user agent; it cannot be directly manipulated by authors. This ensures that "nested" invocations of top-layer-using APIs, like a popup within a popup, will display correctly. Note: The top layer interacts with the overlay property in a somewhat unusual way. See overlay for details.
The top layer (and the pending top layer removals) should not be interacted with directly by specification algorithms. (Individual features using the top layer might have ownership over various things in the top layer, like a popover inside of a popover, that need to be reordered or moved as a group.) Instead, specifications should use the following algorithms. 3.1. Top Layer StylingEvery element rendered in the top layer, as well as its corresponding ::backdrop pseudo-element, are rendered with the following qualities:
3.2. The ::backdrop Pseudo-ElementEach element rendered in the top layer has a ::backdrop pseudo-element, for which it is the originating element. When its computed content value is not none, ::backdrop pseudo-elements generate boxes as if they were siblings of the root element. They’re automatically rendered as a separate item in the top layer, below their originating element. (See "paint a document" for details.) Note: The ::backdrop pseudo-element can be used to create a backdrop that hides the underlying document for an element in a top layer (such as an element that is displayed fullscreen). The ::backdrop pseudo-element is a fully styleable pseudo-element. User agents should contain the following rules in a UA-level style sheet: ::backdrop Other specifications can additional properties to the default ::backdrop rendering. Note: For example, a fullscreen element (see [FULLSCREEN]) styles its ::backdrop as opaque black by default. See § 3.1 Top Layer Styling for additional details on how ::backdrop elements are rendered. 3.3. Top Layer Manipulation
An element el is in the top layer
if el is contained in its node document’s top layer
but not contained in its node document’s pending top layer removals.
Note: Specs should use this concept, rather than rendered in the top layer, when they are manipulating the top layer itself. Using this concept avoids the behavior being different based on whether there’s an overlay transition, or whether two operations happened between rendering updates or across them.
An element el is rendered in the top layer
if el is contained in its node document’s top layer,
and el has overlay: auto.
Note: Specs should use this concept, rather than in the top layer, when they are not manipulating the top layer itself, but rather responding to the rendering behavior of being "on top of everything". For example, the presence of a ::backdrop pseudo relies on the element being rendered in the top layer; even if the element is pending removal, it has a ::backdrop as long as it’s being displayed on top of everything.
To add an element to the top layer,
given an
Element el:
To request an element to be removed from the top layer,
given an
Element el:
To remove an element from the top layer immediately,
given an
Element el:
Note: This algorithm is only intended to be used in special cases where removing something from the top layer immediately (bypassing things like an overlay transition) is necessary, such as a modal dialog that is removed from the document. Most of the time, requesting removal from the top layer is more appropriate.
To process top layer removals,
given a
Document doc:
Note: This is intended to be called during the "Update the Rendering" step of HTML’s rendering algorithm. It is not intended to be called by other algorithms. Note: The overlay check can be delayed arbitrarily long by author-level transitions; see § 3.4 Controlling the Top Layer: the overlay property for details. 3.4. Controlling the Top Layer: the overlay property
When an element is in the top layer, the overlay property determines whether it is actually rendered in the top layer or not.
Note: overlay is a somewhat unusual property,
as it is only set by the user agent,
and can’t be set by authors at all.
However, authors do have the ability to affect when overlay changes its value, by setting a transition on the property. This allows an author to align an animation with the transition, with the element moving in or out of the top layer only at the desired point in the animation. This allows, for example, an animation that causes an element to fade out of its normal position on the page, then fade in at its new top-layer position, or vice versa. For animation,
auto is interpolated as a discrete step
where values of p such that Note: This is similar to how visibility animates. With most easing functions, this will keep the element rendered in the top layer for the entire duration of the transition, whether it’s entering or leaving the top layer. step-start/step-end/linear() can be used to control when the value flips more precisely. User agents must have the following rule in their UA stylesheet: * Note: This means that the overlay property cannot be set by authors or users—it is entirely controlled by the user agent (which sets elements to overlay: auto, via another UA-!important rule, when they’re in the top layer). User agents may, at their discretion, remove a running transition on overlay. The conditions for this are intentionally undefined. (This is to prevent potential abuse scenarios where a transition: overlay 1e9s; or similar attempts to keep an element in the top layer permanently.) 4. Painting Order and Stacking ContextsThis chapter describes the painting order of CSS’s box tree. When traversing the box tree, tree order is often used. For fragments, this refers to the logical order of the fragments, not the visual order. (This can be relevant, for example, when rending bidirectional text.) Painting order is defined in terms of a "painter’s model", where elements are described as painting in a stack, with the bottom of the stack rendered "first", below items higher in the stack. The user is implied to exist above the top of the stack, looking down: | | |
| | | ⇦ 🧑🎨
| | user
z-index: canvas -1 0 1
The stacking context background and most negative positioned stacking contexts are at the bottom of the stack, while the most positive positioned stacking contexts are at the top of the stack. The canvas is transparent if contained within another, and given a UA-defined color if it is not. It is infinite in extent and contains the root element. Initially, the viewport is anchored with its top left corner at the canvas origin.
To paint a document,
given a document doc
and an infinite canvas canvas:
To paint a stacking context
given an element, pseudo-element, or box root,
and an infinite canvas canvas:
To paint a block’s decorations
given a block box root
and a canvas canvas:
To paint a box in a line box,
given a box root,
a line box line box,
and a canvas canvas:
Note: Even though the visual order of inline box fragments can be rearranged within a line due to bidirectional reordering, the fragments are nevertheless painted in tree order.
To paint a stacking container,
given a box root
and a canvas canvas:
UAs can draw outlines (from the outline property) either in-band (painted along each element, and thus potentially obscured/overlapping by following content) or out-of-band (all outlines painted at the end of the stacking context, so nothing in the stacking context can obscure them). It is recommended that UAs use out-of-band outlines, as making outlines easily visible is an important accessibility feature. 5. ChangesSignificant changes since the 8 July 2025 First Public Working Draft:
Privacy ConsiderationsNo new privacy considerations have been reported on this specification. Security ConsiderationsNo new security considerations have been reported on this specification. | ||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |