<u>

这篇翻译不完整。请帮忙从英语翻译这篇文章

HTML <u> 元素使文本在其内容的基线下的一行呈现下划线。在HTML5中, 此元素表示具有未标注的文本跨度,显示渲染,非文本注释,例如将文本标记为中文文本中的专有名称(一个正确的中文标记), 或 将文本标记为拼写错误。

Content categories Flow content, phrasing content, palpable content.
Permitted content Phrasing content.
Tag omission 不允许,开始标签和结束标签都不能省略。
Permitted parents Any element that accepts phrasing content.
Permitted ARIA roles Any
DOM interface HTMLElement Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the HTMLSpanElement interface for this element.

Attributes

This element only includes the global attributes.

Usage notes

As with all pure styling elements, <u> was deprecated in HTML 4 and XHTML 1, but was then re-introduced in HTML5 with other semantics. If you want to underline text in a non-semantic manner, you should use a <span> element, or another semantically appropriate element, and style it with the CSS text-decoration property, with the underline value.

Tip: Avoid using the <u> element where it could be confused for a hyperlink.

Note: The HTML 5 specification reminds developers that other elements are almost always more appropriate than <u>.

Example

The following are examples of how elements other than <u> should be used instead.

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

Due to the default styling of <em> and <i> they have been displayed in italics, however CSS can be used to style those elements with a normal font style and underline.

Specifications

Specification Status Comment
WHATWG HTML Living Standard
<u>
Living Standard  
HTML5
<u>
Recommendation  
HTML 4.01 Specification
<b>
Recommendation  

See Also

  • The <span>, <i>, <em>, and <cite> elements are, depending on the case, to be used instead.
  • The CSS text-decoration property is to be used to achieve the former visual aspect of the <u> element.

文档标签和贡献者

 此页面的贡献者: hawm
 最后编辑者: hawm,