Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 464125 of <hr>

  • Revision slug: Web/HTML/Element/hr
  • Revision title: <hr>
  • Revision id: 464125
  • Created:
  • Creator: justleroy
  • Is current revision? No
  • Comment

Revision Content

Summary

In {{HTMLVersionInline(5)}} the HTML <hr> element represents a thematic break between paragraph-level elements (for example, a change of scene in a story, or a shift of topic with a section). In previous versions of HTML, it represented a horizontal rule. It may still be displayed as a horizontal rule in visual browsers, but is now defined in semantic terms, rather than presentational terms.

  • Content categories Flow content.
  • Permitted content None; it is a void element.
  • Tag omission It must have start tag, but must not have an end tag
  • Permitted parent elements Any element that accepts flow content.
  • DOM interface {{domxref("HTMLHRElement")}}

Attributes

This element includes the global attributes.

{{htmlattrdef("align")}} {{deprecatedGeneric("inline","HTML4.01")}} {{obsoleteGeneric("inline","HTML5")}}
Sets the alignment of the rule on the page. If no value is specified, the default value is left.
{{htmlattrdef("color")}} {{Non-standard_inline}}
Sets the color of the rule through color name or hexadecimal value.
{{htmlattrdef("noshade")}} {{deprecatedGeneric("inline","HTML4.01")}} {{obsoleteGeneric("inline","HTML5")}}
Sets the rule to have no shading.
{{htmlattrdef("size")}} {{deprecatedGeneric("inline","HTML4.01")}} {{obsoleteGeneric("inline","HTML5")}}
Sets the height, in pixels, of the rule.
{{htmlattrdef("width")}} {{deprecatedGeneric("inline","HTML4.01")}} {{obsoleteGeneric("inline","HTML5")}}
Sets the length of the rule on the page through a pixel or percentage value.

Example

<p>This is the first paragraph of text. This is the first paragraph of text.
  This is the first paragraph of text. This is the first paragraph of text.</p>

<hr>

<p>This is second paragraph of text. This is second paragraph of text.
  This is second paragraph of text. This is second paragraph of text.</p>

Above HTML will output:

This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text.


This is second paragraph of text. This is second paragraph of text. This is second paragraph of text. This is second paragraph of text.

Notes

To change look of rule or gaps between it and paragraphs, use cascading style sheets.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'grouping-content.html#the-hr-element', '<hr>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'grouping-content.html#the-hr-element', '<hr>')}} {{Spec2('HTML5 W3C')}}  
{{SpecName('HTML4.01', 'present/graphics.html#h-15.3', '<hr>')}} {{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

{{HTML:Element_Navigation}}

Revision Source

<h2 id="Summary">Summary</h2>
<p>In {{HTMLVersionInline(5)}} the <strong>HTML <code>&lt;hr&gt;</code> element</strong> represents a thematic break between paragraph-level elements (for example, a change of scene in a story, or a shift of topic with a section). In previous versions of HTML, it represented a horizontal rule. It may still be displayed as a horizontal rule in visual browsers, but is now defined in semantic terms, rather than presentational terms.</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>.</li>
  <li><dfn>Permitted content</dfn> None; it is a void element.</li>
  <li><dfn>Tag omission</dfn> It must have start tag, but must not have an end tag</li>
  <li><dfn>Permitted parent elements</dfn> Any element that accepts <a href="/en-US/docs/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">flow content</a>.</li>
  <li><dfn>DOM interface</dfn> {{domxref("HTMLHRElement")}}</li>
</ul>
<h2 id="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("align")}}&nbsp;{{deprecatedGeneric("inline","HTML4.01")}}&nbsp;{{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    Sets the alignment of the rule on the page. If no value is specified, the default value is <code>left</code>.</dd>
  <dt>
    {{htmlattrdef("color")}} {{Non-standard_inline}}</dt>
  <dd>
    Sets the color of the rule through color name or hexadecimal value.</dd>
  <dt>
    {{htmlattrdef("noshade")}}&nbsp;{{deprecatedGeneric("inline","HTML4.01")}}&nbsp;{{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    Sets the rule to have no shading.</dd>
  <dt>
    {{htmlattrdef("size")}}&nbsp;{{deprecatedGeneric("inline","HTML4.01")}}&nbsp;{{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    Sets the height, in pixels, of the rule.</dd>
  <dt>
    {{htmlattrdef("width")}}&nbsp;{{deprecatedGeneric("inline","HTML4.01")}}&nbsp;{{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    Sets the length of the rule on the page through a pixel or percentage value.</dd>
</dl>
<h2 id="Example">Example</h2>
<pre class="brush: html">
&lt;p&gt;This is the first paragraph of text. This is the first paragraph of text.
  This is the first paragraph of text. This is the first paragraph of text.&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;This is second paragraph of text. This is second paragraph of text.
  This is second paragraph of text. This is second paragraph of text.&lt;/p&gt;
</pre>
<p>Above HTML will output:</p>
<p>This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text.</p>
<hr />
<p>This is second paragraph of text. This is second paragraph of text. This is second paragraph of text. This is second paragraph of text.</p>
<h2 id="Notes">Notes</h2>
<p>To change look of rule or gaps between it and paragraphs, use <a href="/en-US/docs/CSS" title="CSS">cascading style sheets</a>.</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', 'grouping-content.html#the-hr-element', '&lt;hr&gt;')}}</td>
      <td>{{Spec2('HTML WHATWG')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML5 W3C', 'grouping-content.html#the-hr-element', '&lt;hr&gt;')}}</td>
      <td>{{Spec2('HTML5 W3C')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML4.01', 'present/graphics.html#h-15.3', '&lt;hr&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&nbsp;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">See also</h2>
<ul>
  <li><a href="/en-US/docs/HTML/Element/p" title="HTML/Element/p">HTML Paragraph element</a></li>
</ul>
<div>
  {{HTML:Element_Navigation}}</div>
Revert to this revision