Skip to content

[css-rhythm-1] Avoiding accidental double spacing #938

Open
@frivoal

Description

@frivoal

The spec for https://drafts.csswg.org/css-rhythm/#line-height-step says that

It is usually recommended to set the line-height lower than the step unit. The used line height can increase due to several factors such as the use of vertical-align or font fallback.

The initial value of line-height is normal which is defined like this:

normal
Tells user agents to set the used value to a "reasonable" value based on the font of the element. The value has the same meaning as <number>. We recommend a used value for 'normal' between 1.0 to 1.2. The computed value is 'normal'.

Actual implementations are know to vary, and in practice the actual numerical value of line-height: normal is unpredictable. Ideally authors will not rely on it and manually set the line-height when they want to use line-height-step, but we should try to be robust when they don't.

If normal in a particular browser on a particular os with a particular font is equivalent to 1.15, and on a different browser/os/font combination, it is equal to 1.25, and an author leaves line-height at the default value, and sets line-height-step to 1.2em, things will look fine in one browser and not in the other, and the author may not know if they do not test in that particular browser/os/font combination.

I think it is quite important to reduce or eliminate this kind of situation, so we should do something.

How about this:

When line line-height-step is not 0, then line-height: normal is treated as line-height: 1 when computing the used value. This would usually be appropriate (and in the odd case where it is not, it is always possible to set a manual value), and would eliminate variation between browsers, making naïve use of line-height-step more robust.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions