Skip to content

[css-position] Allow setting multiple named box insets #10754

@johannesodland

Description

@johannesodland

Can we extend the box inset properties to allow authors to set multiple named box insets?

/* Make the element sticky against the scrollport, but only until it's 20px from the containing block */
position: sticky;
inset-block: 
    scrollport 0, 
    containing-block 20px;

A missing inset name should be interpreted automatically based on positioning, the same way insets work today.
(Using auto as an inset name would unfortunately be ambigous as it is also valid as a component value.)

position: absolute;
inset: 0;

Motivation

While one set of box insets is sufficient for most positioning schemes, sticky positioning is concerned with both the scrollport and the containing block. Currently authors can use margins to modify the containing block constraints, but the working group has resolved to ignore margins in sticky-pos calculation.

Margins are problematic as they are also used for in-flow positioning and because it is unclear how collapsing margins would apply. However, there are existing use cases for modifying the containing block constraints and authors should be provided with a means of specifying that inset.

Alternative solutions

#2496 suggests pulling sticky into a separate property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions