How to enable line break at hyphens on Firefox

前端 未结 2 1315
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 10:42

Chrome, IE, and Safari break lines at hyphens but Firefox doesn\'t.

Is there any way to make Firefox break lines at hyphens, like other browsers?

2条回答
  •  忘了有多久
    2021-02-19 11:20

    Not easily. Try inserting a zero-width space () after each hyphen. For example:

    a-​really-​long-​hyphenated-​phrase
    

    This will make Firefox wrap as if there's a space, but it won't visually display that space.

    It's easier to implement this if you have something processing your output server-side. Just run hyphens through a quick string replace.

提交回复
热议问题