The most widely used method is <nobr>X-ray</nobr> . Although not part of the HTML specification, the nobr tag works well.
Currently, using the inextricable hyphen U + 2011 (suggested in other answers, you can also enter it directly if you know how to do this in your editor, and you use UTF-8) works almost as widely. However, there are risks. Support for U + 2011 is not universal in fonts. This means that if you do not take special measures to use the font that contains it, or to use suitable fallback fonts, it is possible that the inextricable hyphen differs from the usual hyphen (which is basically an โAscii hyphenโ on web pages) .
This means that foo-bar and foo-bar (with an inextricable hyphen) may look different since they come from different fonts. In order to see the difference, you may need a trained eye or typographer, but in some font combinations the difference is obvious.
Using nobr , you do not have this problem as the same character is used. The same goes for using <span style="white-space: nowrap">X-ray</span> , but its a bit awkward and a little less reliable (doesn't work when CSS is disabled).
source share