<wbr>

  • Revision slug: HTML/Element/wbr
  • Revision title: <wbr>
  • Revision id: 340961
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment Broken Links

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>

Compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 {{CompatGeckoDesktop("3.0")}} 5.5 11.7 4.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 1.5 {{CompatGeckoMobile("10.0")}} ?? {{CompatNo}} {{CompatNo}}

Revision Source

<div>{{HTMLVersionHeader(5)}}</div>
<h2 id="Summary">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 id="Usage_Context">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-US/docs/HTML/Content_categories#Phrasing_content" title="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 id="Attributes">Attributes</h2>
<p>This element has no attributes other than the <a href="/en-US/docs/HTML/Global_attributes" title="HTML/Global attributes">global attributes</a>.</p>
<h2 id="DOM_Interface">DOM&nbsp;Interface</h2>
<p>This element implements the <a href="/en-US/docs/DOM/HTMLElement" title="DOM/HTMLElement">HTMLElement</a> interface.</p>
<h2 id="Example">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>
<h3 id="Compatibility">Compatibility</h3>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>1.0</td>
        <td>{{CompatGeckoDesktop("3.0")}}</td>
        <td>5.5</td>
        <td>11.7</td>
        <td>4.0</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>1.5</td>
        <td>{{CompatGeckoMobile("10.0")}}</td>
        <td>??</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
Revert to this revision