HTML DOM HR 对象

HR object

The HR object represents the HTML <hr> element.

Access HR object

You can use getElementById() to access the <hr> element:

var x = document.getElementById("myHR");

Try it yourself

Create HR object

You can use the document.createElement() method to create an <hr> element:

var x = document.createElement("HR");

Try it yourself

HR object properties

属性 Description
align

HTML5 中不支持。请改用 style.textAlign

Set or return the alignment of the horizontal line.

color

HTML5 中不支持。请改用 style.color

Set or return the color of the horizontal line.

noshade

HTML5 中不支持。

Set or return whether the horizontal line should be presented in a solid color (without shadow).

size

HTML5 中不支持。请改用 style.height

Set or return the height of the horizontal line.

width

HTML5 中不支持。请改用 style.width

设置或返回水平线的宽度。

标准属性和事件

HR 对象支持标准属性事件

相关页面

HTML 参考手册:HTML <hr> 标签