<wbr>

  • Revision slug: HTML/Element/wbr
  • Revision title: wbr
  • Revision id: 26789
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 4 words added, 2 words removed

Revision Content

{{ HTMLVersionHeader("5") }}

Summary

The Word Break Opportunity (<wbr>) HTML element represents a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location.

On UTF-8 encoded pages, <wbr> behaves like the U+200B ZERO-WIDTH SPACE code point. In particular, it behaves like a Unicode bidi BN code point, meaning it has no effect on bidi-ordering: <div dir=rtl>123,<wbr>456</div> displays, when not broken on two lines, 123,456 and not 456,123.

For the same reason, the <wbr> element does not introduce a hyphen at the line break point. To make a hyphen appear only at the end of a line, use the soft hyphen character entity (&shy;) instead.

This element was first implemented in Internet Explorer 5.5 and was officially defined in HTML5.

Usage Context

Permitted content Empty
Tag omission This is a void element; it must have a start tag, but must not have an end tag.
Permitted parent elements Any element that accepts phrasing content.
Normative document HTML 5, section 4.6.24

Attributes

This element has no attributes other than the global attributes.

DOM Interface

This element implements the HTMLElement interface.

Example

The Yahoo Style Guide recommends breaking a URL before punctuation, to avoid leaving a punctuation mark at the end of the line, which the reader might mistake for the end of the URL.

<p>http://this<wbr>.is<wbr>.a<wbr>.really<wbr>.long<wbr>.example<wbr>.com/With<wbr>/deeper<wbr>/level<wbr>/pages</p>

Revision Source

<p>{{ HTMLVersionHeader("5") }}</p>
<h2>Summary</h2>
<p>The <em>Word Break Opportunit</em><em>y</em> (<code>&lt;wbr&gt;</code>) HTML element represents a position within text where the browser may optionally break a line, though its line-breaking rules would not otherwise create a break at that location.</p>
<p>On UTF-8 encoded pages, <code>&lt;wbr&gt;</code> behaves like the <code>U+200B</code><code> ZERO-WIDTH SPACE</code> code point. In particular, it behaves like a Unicode bidi BN code point, meaning it has no effect on bidi-ordering: <code>&lt;div dir=rtl&gt;123,&lt;wbr&gt;456&lt;/div&gt;</code> displays, when not broken on two lines, <code>123,456</code> and not <code>456,123</code>.</p>
<p>For the same reason, the <code>&lt;wbr&gt;</code> element does not introduce a hyphen at the line break point. To make a hyphen appear only at the end of a line, use the soft hyphen character entity (<code>&amp;shy;</code>) instead.</p>
<p>This element was first implemented in Internet Explorer 5.5 and was officially defined in HTML5.</p>
<h2>Usage Context</h2>
<table class="standard-table"> <tbody> <tr> <td>Permitted content</td> <td>Empty</td> </tr> <tr> <td>Tag omission</td> <td>This is a void element; it must have a start tag, but must not have an end tag.</td> </tr> <tr> <td>Permitted parent elements</td> <td>Any element that accepts <a href="/en/HTML/Content_categories#phrasing_content" title="en/HTML/Content categories#phrasing content">phrasing content</a>.</td> </tr> <tr> <td>Normative document</td> <td><a class="external" href="http://dev.w3.org/html5/spec/text-level-semantics.html#the-wbr-element" title="http://dev.w3.org/html5/spec/text-level-semantics.html#the-wbr-element">HTML 5, section 4.6.24</a></td> </tr> </tbody>
</table>
<h2>Attributes</h2>
<p>This element has no attributes other than the <a href="/en/HTML/Global_attributes" title="en/HTML/Global attributes">global attributes</a>.</p>
<h2>DOM Interface</h2>
<p>This element implements the <a href="/en/DOM/HTMLElement" title="en/DOM/HTMLElement">HTMLElement</a> interface.</p>
<h2>Example</h2>
<p><span style="font-style: italic;"><a class="external" href="http://styleguide.yahoo.com/" title="http://styleguide.yahoo.com/">The Yahoo Style Guide</a> </span>recommends <a class="external" href="http://styleguide.yahoo.com/editing/treat-abbreviations-capitalization-and-titles-consistently/website-names-and-addresses" title="http://styleguide.yahoo.com/editing/treat-abbreviations-capitalization-and-titles-consistently/website-names-and-addresses">breaking a URL <em>before</em> punctuation</a>, to avoid leaving a punctuation mark at the end of the line, which the reader might mistake for the end of the URL.</p>
<pre class="brush: html">&lt;p&gt;http://this&lt;wbr&gt;.is&lt;wbr&gt;.a&lt;wbr&gt;.really&lt;wbr&gt;.long&lt;wbr&gt;.example&lt;wbr&gt;.com/With&lt;wbr&gt;/deeper&lt;wbr&gt;/level&lt;wbr&gt;/pages&lt;/p&gt;
</pre>
Revert to this revision