HTML change line break trigger?

后端 未结 5 873
面向向阳花
面向向阳花 2021-01-13 06:21

Is there any way in CSS/HTML to change what characters cause linebreaks in text to be allowed? For example if I have table data containing the text \"fooooooo/barrrrrrrrr\"

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-13 06:41

    There is no way to tell the browser to allow wrapping on specific characters.

    The CSS3 word-wrap: break-word; property will get you part of the way there by allowing the line to break on any character. This will happen if the text is longer than the computed maximum width of its containing element.

    If you are dynamically generating the HTML output server-side, you could do a regex search and replace to insert a space before the character you'd like to (optionally) wrap on but, without knowing the context, it's hard to be more specific about that.

提交回复
热议问题