<hr>: The Thematic Break (Horizontal Rule) element

<hr> HTML 元素表示段落级元素之间的主题分隔:例如,故事中场景的变化,或者章节中主题的转变。

¥The <hr> HTML element represents a thematic break between paragraph-level elements: for example, a change of scene in a story, or a shift of topic within a section.

Try it

从历史上看,这被表现为水平的规则或线。虽然它仍然可能在可视浏览器中显示为水平线,但该元素现在是用语义术语而不是表示术语定义的,因此如果你希望绘制水平线,则应该使用适当的 CSS 来实现。

¥Historically, this has been presented as a horizontal rule or line. While it may still be displayed as a horizontal rule in visual browsers, this element is now defined in semantic terms, rather than presentational terms, so if you wish to draw a horizontal line, you should do so using appropriate CSS.

属性

¥Attributes

该元素的属性包括 全局属性

¥This element's attributes include the global attributes.

align Deprecated Non-standard

设置页面上规则的对齐方式。如果未指定值,则默认值为 left

color Deprecated Non-standard

通过颜色名称或十六进制值设置规则的颜色。

noshade Deprecated Non-standard

将规则设置为没有阴影。

size Deprecated Non-standard

设置规则的高度(以像素为单位)。

width Deprecated Non-standard

通过像素或百分比值设置页面上规则的长度。

示例

¥Example

HTML

html
<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 the second paragraph of text. This is the second paragraph of text.
  This is the second paragraph of text. This is the second paragraph of text.
</p>

结果

¥Result

技术总结

¥Technical summary

内容类别 流量内容.
允许的内容 没有任何;这是 void element
标签遗漏 必须有开始标记,并且不能有结束标记。
允许的父级
隐式 ARIA 角色 separator
允许的 ARIA 角色 presentationnone
DOM 接口 HTMLHRElement

规范

Specification
HTML Standard
# the-hr-element

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看