Word-wrap in an HTML table

后端 未结 25 3248
温柔的废话
温柔的废话 2020-11-22 02:45

I\'ve been using word-wrap: break-word to wrap text in divs and spans. However, it doesn\'t seem to work in table cells. I have a tabl

25条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 03:29

    It appears you need to set word-wrap:break-word; on a block element (div), with specified (non relative) width. Ex:

    loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong word
    Foo

    or using word-break:break-all per Abhishek Simon's suggestion.

提交回复
热议问题