<hr>
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
HTML 的** <hr>
元素**代表在段落層級的焦點轉換(如故事中的場景轉換或某個小節裡的主題移轉)。在之前的 HTML 版本,它代表著一條水平標線。在視覺瀏覽器裡,它現在可能還是以水平標線的型式呈現;但它已經被重新定義為一個語義上的用詞,而不是呈現上的。
內容類型 | 流內容. |
---|---|
Permitted content | 否。這是個 empty element. |
標籤省略 | 一定要有起始標籤、同時絕不能有結束標籤 |
Permitted parent elements | 任何允許流內容的元素。 |
DOM interface | HTMLHRElement |
屬性
這個元素支持全域屬性。
align
已棄用-
設罝頁面上標線的對齊方式。如果沒有指定,預設值是:
left。
color
Non-standard-
用色彩名或 16 進位值設罝標線的顏色。
noshade
已棄用-
設置這個標線沒有陰影。
size
已棄用-
設置標線的高度,單位是 px。.
width
已棄用-
設置標線的長度,單位是 px;或者也可以用頁面寛度的百分比 (%)表示。
範例
<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 second paragraph of text. This is second paragraph of text. This is
second paragraph of text. This is second paragraph of text.
</p>
上面的 HTML 會輸出:
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.
This is second paragraph of text. This is second paragraph of text. This is second paragraph of text. This is second paragraph of text.
規範
Specification |
---|
HTML Standard # the-hr-element |
瀏覽器相容性
BCD tables only load in the browser