Latest web development tutorials

HTML <hr> tag

Examples

When the subject matter changes, use <hr> tag separated:

<h1>HTML</h1>
<p>HTML 是用于描述 web 页面的一种语言。</p>

<hr>

<h1>CSS</h1>
<p>CSS 定义如何显示 HTML 元素。</p>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support <hr> tag.


Tag definitions and instructions

<Hr> tag defines an HTML page relating to the change (such as the subject's), and displayed as a horizontal line.

<Hr> element is used to separate HTML page content (or a change in the definition).


Differences between HTML 4.01 and HTML5

In HTML5, <hr> define the content of the theme changes, and appears as a horizontal line.

In HTML 4.01, <hr> tag is only displayed as a horizontal line.

In HTML 4.01, all layout properties are obsolete . In HTML5 these attributes are no longer supported. Use CSS to define the style for the <hr> element.


Differences between HTML and XHTML

In HTML, <hr> tag has no end tag.

In XHTML, <hr> tag must be properly closed, such as <hr />.


Attributes

属性 描述
align left
center
right
HTML5 不支持。HTML 4.01 已废弃。 规定 <hr> 元素的对齐方式
noshade noshade HTML5 不支持。HTML 4.01 已废弃。 规定 <hr> 元素的颜色呈现为纯色。
size pixels HTML5 不支持。HTML 4.01 已废弃。 规定 <hr> 元素的高度。
width pixels
%
HTML5 不支持。HTML 4.01 已废弃。 规定 <hr> 元素的宽度。


Global Properties

<hr> tag supports HTML global properties .


Event Properties

<hr> tag supports HTML event properties .