Difference between overflow-wrap and word-break?

后端 未结 3 1530
后悔当初
后悔当初 2020-11-28 23:50

What´s the exact difference between overflow-wrap/word-wrap and word-break? And can anybody tell me what´s the better one for breaking

3条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 00:04

    Quoting from source

    • word-wrap: The word-wrap CSS property is used to specify whether or not the browser may break lines within words in order to prevent overflow when an otherwise unbreakable string is too long to fit in its containing box.

    • overflow-wrap: word-wrap property has been renamed overflow-wrap in the current draft of the CSS3 Text specification

    • word-break: The word-break CSS property is used to specify how (or if) to break lines within words

    So, you need word-break in combination with word-wrap, which is the right combination.

提交回复
热议问题