3 out of 4 rated this helpful - Rate this topic

wbr element | wbr object

[This documentation is preliminary and is subject to change.]

Inserts a soft line break into a block of NOBR text.

Standards information

HTML information

Closing Tagforbidden
CSS Display

Remarks

A soft line break is a point inside a NOBR section at which a line break is permitted but not required.

Examples

This example uses the WBR element to create line breaks. In contrast, the NOBR element does not break lines.


<NOBR>This line of text will not break, no matter how narrow the window gets.</NOBR>
<NOBR>This one, however,<WBR> will break after the word "however," 
if the window gets small enough.</NOBR>

See also

br

 

 

Build date: 3/8/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
IE & Firefox friendly HTML line breaking

I was hunting around the web for good pages describing standards-friendly (aka Firefox-friendly!) ways to replace the WBR element which works great on IE but not on Firefox.

After 20 minutes of searching, the best workarond I found was to use separate NOBR blocks. In other words, instead of this, which won't work on Firefox:

<nobr>don't break this text until right before<wbr>
here, although breaking it before "here" is OK</nobr>

you can instead use this:

<nobr>don't break this text until right before </nobr><nobr>
here, although breaking it before "here" is OK</nobr>

This is not standards compliant and is not XHTML compliant, but at least works on Firefox.

Another suggestion (from https://bugzilla.mozilla.org/show_bug.cgi?id=6347 is to use CSS to make a space really small, so that it doesn't look like a space but still enables breaking. Warning: this may generate a 1px space in some IE versions, even though the CSS asks for 0px.

<span style="font-size: 0px"> </span> 

An exhaustive disucssion of the issues surrounding HTML line breaking is here:
http://www.cs.tut.fi/~jkorpela/html/nobr.html
Warning, this doc is long but is *very* thorough.