I understand that this tag could easily be replaced with and a little bit of CSS, but in real life markup I often find that
<
Feel free to use the obsolete/non-standard
It's virtually guaranteed that this element name will never be repurposed for any task other than its original behavior, and this name is descriptive of the action you'll define in CSS, making it intuitive for people reviewing your HTML.
Custom elements (including obsolete elements) will make your code fail to validate as HTML.
Your CSS will need to look like this:
nobr { white-space: nowrap; hyphens: none; }
You may or may not want (or need) the hyphens: none;
part, but I have added it for completeness since it appears some implementations of
(used to?) also suppress hyphenation while white-space: nowrap;
does not do that.
This defines the white-space as nowrap
, which suppresses line breaks within white space and the hyphens as none
, which prevents breaking within words (including ignoring characters within words that "suggest line break points").