Skip to content

[css-text] Prevent line break after hyphen preceded by space #3463

Open
@valtlai

Description

@valtlai

I want to prevent a line break after a hyphen that is preceded by a space.

So a string like

foo bar -baz

can be broken as

foo bar
-baz

but not

foo bar -
baz

I’m not sure if this can be solved by CSS spec (e.g., a new keyword for hyphens or overflow-wrap, etc.) or if it’s a browser bug: Firefox does like described by default, Chrome doesn’t.

(Demo: https://codepen.io/valtlai/pen/WLRjeo/left/?editors=1100)

Another example

String:

foo -webkit-baz

Allowed:

foo -webkit-
baz

Disallowed:

foo -
webkit-baz

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