Skip to content

[css-line-grid][css-rhythm] solve the leading adjustment problem of the line-grid #941

@frivoal

Description

@frivoal

Line grid has an problem, alluded to in the Leading adjustments section.

If mixed fonts are used either explicitly or through fallbacks and some of the fonts are larger that then default font on the element, or are no larger but have a different baseline position, lines will be double spaced, even if visually it looks like there is plenty of room. The same problem may occur when if <sub> or <sup> are used.

If there was an allowed margin of error by which things are allowed to stick out before causing the line box to be shifted down, we could avoid this problem, but it isn't clear what that margin should be. I think that combining line-height-step with the line grid may be a way to solve that.

Reusing the terminology I proposed in #940, the difference between the natural line box and the adjusted line box could be this margin of error.

Here are a handful of proposals about how this might work:

  1. "Independent but complementary"
  1. The short-hand approach
    Same as (1), plus make line-height-step a longhand of line-grid and redefine line-grid as
    create <line-height-step>? | match-parent

  2. The auto approach
    Same as (1), plus redefine line-grid to
    create <length>? | match-parent
    and line-height-step to auto | <length>, with line-height-step:auto getting its value from the <length> param of line-grid.

  3. The "just the line grid" approach
    redefine line-grid to
    create <length>? | match-parent
    and use the extra parameter to give some breathing room to the line box, without invoking step-sizing.

1, 2 and 3 are sort of the same, but they cascade differently (and 2&3 should be identical if the author doesn't specify the line-height-step property). It is not entirely obvious to me if the fact that (unlike line-grid) line-height-step is inherited was a useful thing or a footgun. It case it is not a useful thing, solution 4 deals with the line-grid problem without getting the potential footgun.

Yet an other alternative is to make line-height-step non inherited, in which case 2/3/4 become much more similar to eachother (i.e. identical if the author doesn't specify the line-height-step property).

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