试一试
<p>§1: The first rule of Fight Club is: You do not talk about Fight Club.</p>
<hr />
<p>§2: The second rule of Fight Club is: Always bring cupcakes.</p>
hr {
border: none;
border-top: 3px double #333333;
color: #333333;
overflow: visible;
text-align: center;
height: 5px;
}
hr::after {
background: white;
content: "§";
padding: 0 4px;
position: relative;
top: -13px;
}
历史上,这被呈现为一条水平线或分隔线。虽然在视觉浏览器中它仍然可以显示为一条水平线,但该元素现在是根据语义而不是表现来定义的,所以如果你想绘制一条水平线,你应该使用合适的 CSS 来实现。
属性
此元素的属性包括全局属性。
align
已弃用 非标准-
设置页面上分隔线的对齐方式。如果未指定值,则默认值为
left
。 color
已弃用 非标准-
通过颜色名称或十六进制值设置分隔线的颜色。
noshade
已弃用 非标准-
设置分隔线不显示阴影。
size
已弃用 非标准-
设置分隔线的高度(以像素为单位)。
width
已弃用 非标准-
通过像素值或百分比值设置页面上分隔线的长度。
示例
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>
结果
技术摘要
内容类别 | 流内容. |
---|---|
允许内容 | 无;它是一个空元素。 |
标签省略 | 必须有起始标签,且不能有结束标签。 |
允许父级 | |
隐式 ARIA 角色 | separator |
允许的 ARIA 角色 |
presentation 或 none |
DOM 接口 | HTMLHRElement |
规范
规范 |
---|
HTML # the-hr-element |
浏览器兼容性
加载中…