From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/html/element/hr/index.html | 120 +++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 files/zh-cn/web/html/element/hr/index.html (limited to 'files/zh-cn/web/html/element/hr') diff --git a/files/zh-cn/web/html/element/hr/index.html b/files/zh-cn/web/html/element/hr/index.html new file mode 100644 index 0000000000..0cb5efd486 --- /dev/null +++ b/files/zh-cn/web/html/element/hr/index.html @@ -0,0 +1,120 @@ +--- +title:
+slug: Web/HTML/Element/hr +tags: + - Element + - HTML + - HTML grouping content + - Reference + - 元素 + - 参考 +translation_of: Web/HTML/Element/hr +--- +
{{HTMLRef}}
+ +

HTML <hr> 元素表示段落级元素之间的主题转换(例如,一个故事中的场景的改变,或一个章节的主题的改变)。

+ + + +

在HTML的早期版本中,它是一个水平线。现在它仍能在可视化浏览器中表现为水平线,但目前被定义为语义上的,而不是表现层面上。所以如果想画一条横线,请使用适当的css样式来修饰。

+ +
{{EmbedInteractiveExample("pages/tabbed/hr.html", "tabbed-shorter")}}
+ +
+

要更改 <hr> 与段落之间的间隙或样式,请使用 CSS

+
+ + + +

属性

+ +

该元素包含全局属性

+ +
+
{{htmlattrdef("align")}} {{deprecated_inline}}
+
设置对齐方式. 如果没有值, 默认值为 left。
+
{{htmlattrdef("color")}} {{Non-standard_inline}}
+
使用颜色名或十六进制设置颜色。
+
{{htmlattrdef("noshade")}} {{deprecated_inline}}
+
去除阴影。
+
{{htmlattrdef("size")}} {{deprecated_inline}}
+
使用像素设置高度。
+
{{htmlattrdef("width")}} {{deprecated_inline}}
+
使用像素或者百分比设置宽度。
+
+ +

示例

+ +

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>
+ +

结果

+ +

{{EmbedLiveSample("Example")}}

+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
规范状态备注
{{SpecName('HTML WHATWG', 'grouping-content.html#the-hr-element', '<hr>')}}{{Spec2('HTML WHATWG')}}Definition of the hr element
{{SpecName('HTML WHATWG', 'rendering.html#the-hr-element-0')}}{{Spec2('HTML WHATWG')}}Suggested default rendering of the hr element
{{SpecName('HTML5 W3C', 'grouping-content.html#the-hr-element', '<hr>')}}{{Spec2('HTML5 W3C')}}
{{SpecName('HTML4.01', 'present/graphics.html#h-15.3', '<hr>')}}{{Spec2('HTML4.01')}}
+ +

浏览器兼容性

+ + + +

{{Compat("html.elements.hr")}}

+ +

相关内容

+ + -- cgit v1.2.3-54-g00ecf