<br>

  • Revision slug: Web/HTML/Element/br
  • Revision title: <br>
  • Revision id: 391157
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment Moved From HTML/Element/br to Web/HTML/Element/br

Revision Content

Summary

The HTML <br> Element (or HTML Line Break Element) produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.

Do not use <br> to increase the gap between lines of text; use the CSS {{cssxref('margin')}} property or the {{HTMLElement("p")}} element.

  • Content categories Flow content, phrasing content.
  • Permitted content None, it is a void element.
  • Tag omission Must have a start tag, and must not have an end tag. In XHTML documents, write this element as <br />.
  • Permitted parent elements Any element that accepts phrasing content.
  • DOM interface {{domxref("HTMLBRElement")}}

Attributes

This element includes the global attributes.

{{htmlattrdef("clear")}} {{deprecatedGeneric('inline','HTML4.01')}} {{obsoleteGeneric('inline','HTML5')}}
Indicates where to begin the next line after the break.

Usage note: This attribute is obsolete in {{HTMLVersionInline(5)}} and should not be used by authors. Use the CSS {{CSSxref('clear')}} property instead.

Example

Mozilla Foundation<br>
1981 Landings Drive<br>
Building K<br>
Mountain View, CA 94043-0801<br>
USA

The HTML above outputs:

Mozilla Foundation
1981 Landings Drive
Building K
Mountain View, CA 94043-0801
USA

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-br-element', '<br>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'the-br-element.html#the-b-element', '<br>')}} {{Spec2('HTML5 W3C')}}  
{{SpecName('HTML4.01', 'struct/text.html#h-9.3.2.1', '<br>')}} {{Spec2('HTML4.01')}}  

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

See also

  • {{HTMLElement("address")}} element
  • {{HTMLElement("p")}} element
{{HTML:Element_Navigation}}

Revision Source

<h2 id="Summary" name="Summary">Summary</h2>
<p>The <strong>HTML <code>&lt;br&gt;</code> Element</strong> (or <em>HTML </em><em>Line Break Element</em>) produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.</p>
<p>Do not use <code>&lt;br&gt;</code> to increase the gap between lines of text; use the <a href="/en-US/docs/CSS" title="CSS">CSS</a> {{cssxref('margin')}} property or the {{HTMLElement("p")}} element.</p>
<ul class="htmlelt">
  <li><dfn><a href="/en-US/docs/HTML/Content_categories" title="HTML/Content_categories">Content categories</a></dfn> <a href="/en-US/docs/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">Flow content</a>, <a href="/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content categories#Phrasing content">phrasing content</a>.</li>
  <li><dfn>Permitted content</dfn> None, it is a void element.</li>
  <li><dfn>Tag omission</dfn> Must have a start tag, and must not have an end tag. In XHTML documents, write this element as <code>&lt;br&nbsp;/&gt;</code>.</li>
  <li><dfn>Permitted parent elements</dfn> Any element that accepts <a href="/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content_categories#Phrasing_content">phrasing content</a>.</li>
  <li><dfn>DOM interface</dfn> {{domxref("HTMLBRElement")}}</li>
</ul>
<h2 id="Attributes" name="Attributes">Attributes</h2>
<p><span style="line-height: 21px;">This element includes the&nbsp;</span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">global attributes</a><span style="line-height: 21px;">.</span></p>
<dl>
  <dt>
    {{htmlattrdef("clear")}} {{deprecatedGeneric('inline','HTML4.01')}} {{obsoleteGeneric('inline','HTML5')}}</dt>
  <dd>
    Indicates where to begin the next line after the break.
    <div class="note">
      <p><strong>Usage note: </strong>This attribute is obsolete in {{HTMLVersionInline(5)}} and <strong>should not be used by authors</strong>. Use the CSS {{CSSxref('clear')}} property instead.</p>
    </div>
  </dd>
</dl>
<h2 id="Example" name="Example">Example</h2>
<pre class="brush: html">
Mozilla Foundation&lt;br&gt;
1981 Landings Drive&lt;br&gt;
Building K&lt;br&gt;
Mountain View, CA 94043-0801&lt;br&gt;
USA
</pre>
<p>The HTML above outputs:</p>
<p>Mozilla Foundation<br />
  1981 Landings Drive<br />
  Building K<br />
  Mountain View, CA 94043-0801<br />
  USA</p>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-br-element', '&lt;br&gt;')}}</td>
      <td>{{Spec2('HTML WHATWG')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML5 W3C', 'the-br-element.html#the-b-element', '&lt;br&gt;')}}</td>
      <td>{{Spec2('HTML5 W3C')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML4.01', 'struct/text.html#h-9.3.2.1', '&lt;br&gt;')}}</td>
      <td>{{Spec2('HTML4.01')}}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>
<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 (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>1.0</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</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 Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also" name="See_also">See also</h2>
<ul>
  <li>{{HTMLElement("address")}} element</li>
  <li>{{HTMLElement("p")}} element</li>
</ul>
<div>
  {{HTML:Element_Navigation}}</div>
Revert to this revision