Simon Simon - 1 year ago 80
CSS Question

In HTML, how can I wrap a word at . (dot), just like it wraps at - (dash)?

I have a long word in a table cell that messes up the table layout:

I would like the word to wrap like this word:


How can I get this done, with CSS, without changing the HTML?

Answer Source

If using JS is okay, you can do this. If it is not, then this answer may still be useful for future readers.

var longWord = "".replace(/\./g, '.<wbr>');

Reference on the wbr tag:

Alternatively, you could put a <wbr> after each period manually.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download