While checking an old webpage I created in February of 2009 with the W3C Validator, I received an error for the following code:
<nobr><code>%SystemRoot%\Web\Wallpaper\Ripple.jpg</code></nobr>
The error reported by the W3C Validator, which checks the validity of HTML code was as follows:
Line 387, Column 6: element "NOBR" undefined
I thought "why is the validator complaining about the NOBR tag; that's a valid
tag." But at
Replace NOBR Tags with CSS I discovered, though the tag may still work in
major browsers, the NOBR tag has been deprecated. Though most of the commenters
on the page noted they hadn't even heard of the NOBR tag, which tells a browser
not to break a line of text enclosed within the <nobr>
and
</nobr>
tags, one commenter noted
"Bah humbug, KIDS these days! Never heard of nobr. Bet they’ve never played a
45rpm record or an 8-track either. lol"; I'm old enough to have done both.
The recommendation in the article was to use CSS, instead, to achieve the desired effect. E.g., a span tag such as the following:
<span style="white-space:nowrap;">
Though the article suggested creating a nobr CSS class.
.nobr { white-space:nowrap; }
Someone else suggested using { white-space:pre; }
.
I decided to replace the tag with a CSS span tag so the validator wouldn't complain about it, making the line:
<span style="white-space:nowrap;"><code>%SystemRoot%\Web\Wallpaper\Ripple.jpg</code></span>