What is the best way to break HTML text on slashes (/)?

前端 未结 2 1587
伪装坚强ぢ
伪装坚强ぢ 2021-02-02 07:42

I have an HTML table 360px wide, which works great. The challenge is that sometimes a url appears http://this/is/a/really-really-really-really-really/long/url in th

2条回答
  •  长情又很酷
    2021-02-02 08:08

    You can use word-wrap : break-word; like so:

    http://www.aaa.com/bbb/ccc/ffffd/eee/fff/ggg
    div { width : 50px; border : 1px solid #000; word-wrap : break-word; }

    I tested this in: I.E. 6/7/8, Firefox 7, Opera 11, Safari 5, Chrome 15

    Here is a jsfiddle: http://jsfiddle.net/p4SxG/

提交回复
热议问题