Skip to content

[css-rhythm][css-line-grid] Work out the interaction between line-height-step and line-snap #940

@frivoal

Description

@frivoal

If we're not careful, the line-height-step property and the line grid will interfere instead of complementing each other. (see also #939)

We need to figure out how line-height-step and line-snap interact. I can think of a few possiblilities

  1. When line-snap is not none, line-height-step computes to 0 (or same thing at used value time?)
  2. first adjust the height of the line box, distribute the extra space equally above and below, then shift the adjusted linebox down as necessary to snap to the grid
  3. first adjust the height of the line box, distribute the extra space equally above and below, then shift the "original" linebox down within the adjusted size as necessary to snap to the grid. If this is not enough and we need to shift the "original" linebox by more than the space distributed below, then:
    3.1. distribute the extra space equally above and below and shift the adjusted linebox down as necessary to snap to the grid
    3.2. place all the extra space above, and and shift the adjusted linebox down as necessary to snap to the grid

I am not exactly sure which of these makes more sense, nor whether the same thing is preferred for line-snap: baseline and line-snap: contain or not, or if we should do something else.

Either way, it seems to me that the fix can go into the css-line-grid spec, but maybe we need to add some anchoring terminology in the css-rhythm spec:

  • "the natural line box": the line-box as per CSS21 §10.8 Line height calculations.
  • "the adjusted line box": the line box after its height is adjusted by line-height-step.

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