htmltextsoft-hyphen

How to achieve a soft hyphen in HTML


How can I solve the problem of soft hyphens on my web pages? In text, there can be long words which I might want to line break with a hyphen, but I do not want the hyphen to show if the whole word is on the same line. I have heard of &shy; and of <wbr>.

According to comments on this page <wbr> is a non-standard "tag soup invented by Netscape". It seems like &shy; has its problems with standard compliance as well.

How can I use soft hyphens in HTML in a way that works in all browsers?


Solution

  • According to QuirksMode, &shy; is supported on all major browsers.