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 946085 of <hr>

  • Revision slug: Web/HTML/Element/hr
  • Revision title: <hr>
  • Revision id: 946085
  • Created:
  • Creator: teoli
  • Is current revision? Yes
  • Comment Fixed structure

Revision Content

{{HTMLRef}}

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.

To change look of rule or gaps between it and paragraphs, use Cascading Style Sheets (CSS).

Content categories Flow content.
Permitted content None, it is an {{Glossary("empty 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")}} {{deprecated_inline}}
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")}} {{deprecated_inline}}
Sets the rule to have no shading.
{{htmlattrdef("size")}} {{deprecated_inline}}
Sets the height, in pixels, of the rule.
{{htmlattrdef("width")}} {{deprecated_inline}}
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.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'grouping-content.html#the-hr-element', '<hr>')}} {{Spec2('HTML WHATWG')}} Definition of the hr element
{{SpecName('HTML WHATWG', 'rendering.html#the-hr-element-0')}} {{Spec2('HTML WHATWG')}} Suggested default rendering of the hr element
{{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')}} The align, noshade, size and width attributes are deprecated

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('p')}}

Revision Source

<p>{{HTMLRef}}</p>

<p>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>

<div class="note">
<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> (CSS).</p>
</div>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row"><a href="/en-US/docs/HTML/Content_categories" title="HTML/Content_categories">Content categories</a></th>
   <td><a href="/en-US/docs/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">Flow content</a>.</td>
  </tr>
  <tr>
   <th scope="row">Permitted content</th>
   <td>None, it is an {{Glossary("empty element")}}.</td>
  </tr>
  <tr>
   <th scope="row">Tag omission</th>
   <td>It must have start tag, but must not have an end tag.</td>
  </tr>
  <tr>
   <th scope="row">Permitted parent elements</th>
   <td>Any element that accepts <a href="/en-US/docs/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">flow content</a>.</td>
  </tr>
  <tr>
   <th scope="row">DOM interface</th>
   <td>{{domxref("HTMLHRElement")}}</td>
  </tr>
 </tbody>
</table>

<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")}} {{deprecated_inline}}</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;{{deprecated_inline}}</dt>
 <dd>Sets the rule to have no shading.</dd>
 <dt>{{htmlattrdef("size")}}&nbsp;{{deprecated_inline}}</dt>
 <dd>Sets the height, in pixels, of the rule.</dd>
 <dt>{{htmlattrdef("width")}}&nbsp;{{deprecated_inline}}</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="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>Definition of the <code>hr</code> element</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'rendering.html#the-hr-element-0')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Suggested default rendering of the <code>hr</code> element</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>The <code>align</code>, <code>noshade</code>, <code>size</code> and <code>width</code> attributes are deprecated</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>{{HTMLElement('p')}}</li>
</ul>
Revert to this revision