Skip to content

font-family: monospace, monospace should not deduplicate (the duplication is load-bearing) #1221

@chris-morgan

Description

@chris-morgan

Playground

Input:

code{fony-family:monospace,monospace}

Output (incorrect, changes rendering in most browsers):

code{fony-family:monospace}

Not sure what’s going on? It’s a stupid piece of historical baggage in browsers: monospace, when it’s the only font in the family stack, defaults to probably 13px, when all other text is probably 16px. Can’t find this behaviour in any spec, but everyone’s done it since the very beginning. The whole thing was a mistake in my opinion, and people often work around it with font-size: 1em (or their own size that probably isn’t 81.25%), but I suspect a lot of developers don’t know about it any more because most people use longer font-family declarations (for better or normally for worse).

Well, I like to fix it with font-family: monospace, monospace, which is the only correct way of resolving it within font-family alone (as any other font name could theoretically alter the rendering, if the monospace face is missing a character and the provided name maps to a face other than the default face and which has it).

Unfortunately Lightning CSS removes the duplication. It shouldn’t, specifically if it’s monospace and this would reduce the list to one member.

I don’t know of this idiosyncrasy of font-family affecting anything else, but it conceivably could.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions