?
This document uses PHP Chinese website manual Release
HTML <u>
元素使文本在其內(nèi)容的基線下的一行呈現(xiàn)下劃線。在HTML5中, 此元素表示具有未標(biāo)注的文本跨度,顯示渲染,非文本注釋,例如將文本標(biāo)記為中文文本中的專有名稱(一個(gè)正確的中文標(biāo)記), 或 將文本標(biāo)記為拼寫錯(cuò)誤。
內(nèi)容類別 | Flow content, phrasing content, palpable content. |
---|---|
允許的內(nèi)容 | Phrasing content |
標(biāo)記遺漏 | 沒有,起始和結(jié)束標(biāo)簽都是強(qiáng)制性的。 |
允許的父級(jí) | 任何接受 Phrasing content 的元素。 |
允許ARIA角色 | 任何 |
DOM接口 | HTMLElement包括Gecko 1.9.2(Firefox 4),F(xiàn)irefox實(shí)現(xiàn)了這個(gè)元素的HTMLSpanElement接口。 |
這個(gè)元素只包含全局屬性。
與所有純粹的樣式元素一樣,<u>
在HTML 4和XHTML 1中被棄用,但是隨后在其他語(yǔ)義中被重新引入到HTML5中。如果要以非語(yǔ)義方式對(duì)文本進(jìn)行下劃線,則應(yīng)使用<span>
元素或其他語(yǔ)義適當(dāng)?shù)脑兀⑹褂肅SS text-decoration
屬性對(duì)underline
值進(jìn)行設(shè)置。
提示:避免使用<u>
可能被混淆超鏈接的元素。
注意: HTML 5規(guī)范提醒開發(fā)人員其他元素幾乎總是比較合適<u>
。
以下是<u>
應(yīng)該如何使用元素以外的元素的示例。
<u>Today's Special</u>: Salmon<br /> <span style="text-decoration:underline;">Today's Special</span>: Salmon<!-- Here <span> is used as the underlining is purely decorative and it is applied with CSS -->
Today's Special: Salmon
Today's Special: Salmon
<p><u>All</u> of that is explained in <u>Dive into Python</u></p><p><em>All</em> of that is explained in <i>Dive into Python</i></p><!-- Here the "All" is marked as stressed, using <em>, while "Dive into Python" is marked as a name using <i> -->
All of that is explained in Dive into Python.
All of that is explained in Dive into Python.
由于默認(rèn)的樣式,<em>
并且<i>
已經(jīng)以斜體顯示,但是可以使用CSS來(lái)以正常的字體樣式和下劃線對(duì)這些元素進(jìn)行樣式設(shè)置。
Specification | Status | Comment |
---|---|---|
HTML Living StandardThe definition of '<u>' in that specification. | Living Standard | |
HTML5The definition of '<u>' in that specification. | Recommendation | |
HTML 4.01 SpecificationThe definition of '<b>' in that specification. | Recommendation |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | 1 | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | 1 | (Yes) | (Yes) | (Yes) |