HTML <nobr> Tag

HTML <nobr> element was used to prevent a text from breaking. When using this tag, the text would be displayed on one long line and scrolling may be necessary.

This tag was used with the <wbr> tag which specifies where in a text it would add a line-break. Unlike the <br> tag, the <wbr> tag makes a line break only when the current line has already extended beyond the browser's display window margins.

Note: The <nobr> element is non-standard and should not be used. Although it may still work in some browsers, its use is discouraged since it can be removed at any time.

Recommendation: Use the CSS "white-space" property instead of <nobr> element.

Syntax

The <nobr> element comes in pairs. The content must be written between opening (<nobr>) and closing (</nobr>) elements.

Example

<!DOCTYPE html>
<html>
   <head>
      <title>Title of the document</title>
   </head>
   <body>
      <nobr>
         Here we can see a very long text which is forced to be on a single line, even if it causes the browser to extend the document window and users must scroll right to read the all text.<wbr />
         Here we can see a long text which is inserted in a nobr-tagged content and starts in a new line, because we have used the wbr tag. <wbr />
      </nobr>
   </body>
</html>

Result


The <nobr> element doesn't let symbols and words break inside logical groups.

Example

<!DOCTYPE html>
<html>
   <head>
      <title>Title of the document</title>
   </head>
   <body>
      <p>
         Here 
         <nobr> we can see a very long text which is forced to be on a single line, even if it causes the browser to extend the document window and users must scroll right</nobr>
         to read the all text.
      </p>
   </body>
</html>

The <nobr> element also supports the Global Attributes.