Skip to: content, navigation

by Ian Lloyd

nobr (HTML element)

Spec
Depr. Empty Version
Yes No N/A
Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full

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>
Type
inline elements
Contains
inline elements
Contained by
block-level elements, inline elements

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

Use this for…

Anything goes.

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

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
Date:
Fri, 28 Mar 2008 14:25:56 GMT
Contributed by:
Stevie D

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

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters