Skip to content

[css-page-floats] Snap to nearest edge #1233

@frivoal

Description

@frivoal

There is a common requirements for page (or column) floats that cannot be achieved with the current spec, but could be with a minor tweak.

Authors often want a figure to be floated either to the top or the bottom of the page, whichever is nearest.

This could be achieved by amending the definition of snap-block() as follow:

If near is in effect and the element is within the specified distance both from the start and the end, endthe nearest edge wins. In case the distance to the start and end edges is equal, the end edge wins.

Also, for convenience, and to prevent authors from needing to write snap-block(9999px, near) or other arbitrarily large values just to make sure both edges are within the specified distance, we suggest that the definition of snap-block (without parentheses) is changed to mean snap-block( infinity, near) instead of snap-block(2em, near)

The same changes should be done to snap-inline.


Note: regardless of whether we fix that or not, we need a precise definition of how to measure that distance. I'll file a separate issue for that.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions