NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<hr> (Horizontal Rule)

This element is used to insert a horizontal rule to visually separate document sections. Rules usually are rendered as a raised or etched line.

Standard Syntax

align="center | left | right" (transitional only)
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"id="unique alphanumeric identifier"
noshade="noshade " (transitional only)
size="pixels" (transitional only)
style="style information"
title="advisory information"
width="percentage | pixels" (transitional only)

Attributes Defined by Internet Explorer

accesskey="key" (5.5)
color="color name | #RRGGBB" (4)
language="javascript | jscript | vbs | vbscript" (4)
hidefocus="true | false" (5.5)
tabindex="number" (5.5)
unselectable="on | off" (5.5)

Standard Event Attributes

onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup

Events Defined by Internet Explorer

onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror

Element Specific Attributes

This attribute controls the horizontal alignment of the rule with respect to the page. The default value is left.

This attribute sets the rule color using either a named color or a color specified in the hexadecimal #RRGGBB format. This attribute currently is supported only by Internet Explorer.

This attribute causes the rule to be rendered as a solid bar without shading.

This attribute indicates the height in pixels of the rule.

This attribute indicates how wide the rule should be, specified either in pixels or as a percent of screen width, such as 80 percent.


<hr align="left" noshade size="1" width="420">

<hr align="center" width="100%" size="3" color="#000000">

XHTML example

<hr align="left" noshade size="1" width="350" />


HTML 2, 3.2, 4, 4.01, XHTML 1.0, 1.1
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7


The HTML 4.01 strict specification removes support for the align, noshade, size, and width attributes for horizontal rules. These effects are possible using style sheets.

XHTML 1.0 requires a trailing slash for this element: <hr />

(X)HTML Elements
CSS Properties
Previous: head Next: html
< Home | About | Chapters | Examples | Errata | Reference | Site Map >