What is the difference between “word-break: break-all” versus “word-wrap: break-word” in CSS

前端 未结 10 1205
离开以前
离开以前 2020-11-22 07:39

I am currently wondering what is the difference between the two. When I used both they seem to break the word if it is not fitting the container. But why did W3C made two wa

10条回答
  •  悲&欢浪女
    2020-11-22 08:12

    At least in Firefox (as of v24) and Chrome (as of v30), when applied to content in a table element:

    word-wrap:break-word

    will not actually cause long words to wrap, which can result in the table exceeding the bounds of its container;

    word-break:break-all

    will result in words wrapping, and the table fitting within its container.

    enter image description here

    jsfiddle demo.

提交回复
热议问题