<hr>

HTML  <hr> 元素代表在段落層級的焦點轉換(如故事中的場景轉換或某個小節裡的主題移轉)。在之前的 HTML 版本,它代表著一條水平標線。在視覺瀏覽器裡,它現在可能還是以水平標線的型式呈現;但它已經被重新定義為一個語義上的用詞,而不是呈現上的。

內容類型 流內容.
Permitted content 否。這是個 empty element.
標籤省略 一定要有起始標籤、同時絕不能有結束標籤
Permitted parent elements 任何允許流內容的元素。
DOM interface HTMLHRElement

屬性

這個元素支持全域屬性

align
設罝頁面上標線的對齊方式。如果沒有指定,預設值是:left。
color
用色彩名或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.

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

上面的 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 Status Comment
WHATWG HTML Living Standard
The definition of '<hr>' in that specification.
Living Standard Definition of the hr element
WHATWG HTML Living Standard Living Standard Suggested default rendering of the hr element
HTML5
The definition of '<hr>' in that specification.
Recommendation  
HTML 4.01 Specification
The definition of '<hr>' in that specification.
Recommendation The align, noshade, size and width attributes are deprecated

瀏覽器相容性

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)

參照 (see also)

文件標籤與貢獻者

標籤: 
 此頁面的貢獻者: iigmir, ywchiao
 最近更新: iigmir,