[css-anchor-position][css-page] Suggestion for predefined anchor constants and paged media specific non-element anchors
We think that Anchor Positioning could cover a use case we current have to provide a proprietary property for. That use case is that in paged media it should be possible to position elements relative to the page. To achieve that via anchors we propose two additions to the specification:
-
The concept of predefined anchor constants, which can be unrelated to elements. The syntax could be an ident, without the two dashes, as it is explicitly CSS-defined not author-defined. However, we have no specific preference regarding this.
-
Defining the following constants to refer to boxes of the first page that the absolutely-positioned element has boxes on:
- page-content
- page-padding
- page-border
- page-margin
- page-trim
- page-bleed
- page-media
When the UA has no concept of trim, bleed and media, those should fall back to margin. For non-paged media these anchors could either be not found or fall back to the root element or the view port.
see https://drafts.csswg.org/css-anchor-position-1/#determining https://drafts.csswg.org/css-page-3/#page-model
@bernhardf-ro Can you give a few real-world examples so that it's easier to understand what you're trying to do?
Sorry, I missed this before.
Common use cases are designs that want to move content element to an edge or corner of the page. The attached image is from a sample document that moves the "before" content of level 1 headings to a corner of the page.
Additionally being able to position against the bleed-box is helpful, so its no longer necessary to manually move boxes into the bleed.
In general it allows for some creative designs, especially around forced page breaks.
Yeah, I think there's plenty of reasonable use-cases here. We'll just need to figure out exactly what sort of things to expose; there's potentially a long list of page-related boxes.