Skip to content

[css-text] Prevent pre from inheriting hanging-punctuation by default with a user-agent style rule #9689

Closed

Description

@AmeliaBR

See this post from Tony Mottaz, where there is currently non-interoperable behaviour about whether hanging-punctuation styles inherit into pre-formatted text blocks.

I would recommend adding pre { hanging-punctuation: none; } to the user agent stylesheet (assuming the HTML folks are OK with that). Authors can override if they need to, but I think the more common situation is to want to add typographic niceties to body text but keep text columns neatly monospaced for pre-formatted blocks!

Another option (and this may be how other browsers have implemented it) is to make hanging-punctuation have no effect in a preserved whitespace context. But that removes the author choice.

Either way, the sooner this change is made, the better, just in case there's anyone out there who does like their code braces hanging off the sides of their code block & they get used to the current behaviour.

Activity

  1. css-meeting-bot commented on Jan 10, 2024

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [css-text] Prevent `pre` from inheriting hanging-punctuation by default with a user-agent style rule, and agreed to the following:

    • RESOLVED: Define that hanging punctuation is set to none for pre elements in the user agent style sheet
    The full IRC log of that discussion <fantasai> +1
    <frances> Alan: commment about prevent inheriting by default for hanging punctuation in code
    <jfkthame> +1
    <frances> Florian: No strong opinion, raised by Amelia, she recommends non in user recommended style sheet or have no effect in a preserved space context, not sure to have having punctuation by default, might be nonsensical
    <frances> Elika, Amelia, and Alan: agreed
    <frances> Alan: is there anything else that doesn't make sense in a preformatting context?
    <florian> s/recommends non/recommends none
    <florian> s/recommended style sheet/style sheet
    <frances> Eric: Thinking table cells, less clear than the precase, would it hang over the edge in the table cell
    <frances> Alan: depends on margins and padding, not as clear cut
    <frances> PROPOSAL: Define that hanging punctuation is set to none for pre elements in the user agent style sheet
    <frances> Alan: any objections?
    <frances> fantasai: Spec it first, make an HTML pr, has a default set of styles
    <fantasai> https://www.w3.org/TR/css-text-3/#default-stylesheet
    <frances> Alan: might be easier for html people to take things one by one
    <frances> RESOLVED: Define that hanging punctuation is set to none for pre elements in the user agent style sheet
  2. added a commit that references this issue on Feb 19, 2024
    ea0f559
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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