HTML <hr> Tag

Topic: HTML5 Tags Reference« Prev|Next »

Description

The <hr> (short for horizontal rule) tag is used to insert a horizontal rule or line to separate document sections, visually.

The following table summarizes the usages context and the version history of this tag.

Placement: Block
Content: None. It is an empty element.
Start/End Tag: Start tag: required, End tag: forbidden
Version: HTML 2, 3.2, 4, 4.01, 5

Syntax

The basic syntax of the <hr> tag is given with:

HTML:<hr>; XHTML:<hr />

The example below shows the <hr> tag in action.

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

Tag-Specific Attributes

The following table shows the attributes that are specific to the <hr> tag.

Attribute Value Description
align left
center
right
Obsolete Specifies the horizontal alignment of the rule with respect to the page.
noshade noshade Obsolete Causes the rule to be rendered as a solid bar without 3D bevel/shading effect.
size pixels Obsolete Specifies the height of the rule.
width pixels
%
Obsolete Specifies the width of the rule.
 

Warning:Do not use these attributes! As it has been deprecated in HTML 4.01 and obsolete since HTML5. Use CSS instead.


Global Attributes

Like all other HTML tags, the <hr> tag supports the global attributes in HTML5.


Event Attributes

The <hr> tag also supports the event attributes in HTML5.


Browser Compatibility

The <hr> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: HTML Paragraphs.

Related tag: <br>.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.