Skip to: content, navigation

nobr (HTML element)

Spec
Depr. Empty Version
Yes No N/A
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

<nobr>
</nobr>

Description

The nobr element is a proprietary (as in not based on any standard) one that was used to define sections of text that the browser should not allow to wrap, regardless of what may happen, for example the user resizing the window to a small viewport. As it is deprecated - and the effects can be achieved using CSS - you should not use the element; this is here for reference only.

Using the telephone number example shown here, the image below shows the number firstly if it were viewed with plenty of window width, and secondly where the nobr element content gets wrapped:

Example of nobr element

Example

nobr is being used here to avoid a telephone number getting wrapped mid number:

<p>Our telephone number is <nobr>0800 123 123 123</nobr>.</p>

Use this for…

Anything goes.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

The nobr element has good support in modern browsers (for backwards-compatibility reasons) but should not be used. The pre element may be a suitable HTML alternative in some circumstances, but most likely you would opt for a CSS-based solution (white-space:nowrap).

User-contributed notes

ID:
#1
Contributed:
by Stevie D
Date:
Fri, 28 Mar 2008 14:25:56 GMT

Would it be fair to say that if it's essential that the line isn't broken at that point, &nbsp; would be appropriate instead of the normal space?

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

Search