HTML
Strong Importance Element
(
<strong>
) indicates that its contents have strong importance, seriousness, or urgency. Browsers typically render the contents in bold type.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
| 内容类别 | 流内容 , 措词内容 ,可触及内容。 |
|---|---|
| 准许内容 | 措词内容 . |
| Tag omission | None, must have both a start tag and an end tag. |
| Permitted parents | Any element that accepts 措词内容 , or any element that accepts flow content . |
| Implicit ARIA role | 无对应角色 |
| Permitted ARIA roles | 任何 |
| DOM 接口 |
HTMLElement
|
此元素只包括 全局属性 .
<strong>
element is for content that is of "strong importance," including things of great seriousness or urgency (such as warnings). This could be a sentence that is of great importance to the whole page, or you could merely try to point out that some words are of greater importance compared to nearby content.
Typically this element is rendered by default using a bold font weight. However, it should
not
be used simply to apply bold styling; use the CSS
font-weight
property for that purpose. Use the
<b>
element to draw attention to certain text without indicating a higher level of importance. Use the
<em>
element to mark text that has stress emphasis.
Another accepted use for
<strong>
is to denote the labels of paragraphs which represent notes or warnings within the text of a page.
It is often confusing to new developers why there are so many ways to express the same thing on a rendered website.
<b>
and
<strong>
are perhaps one of the most common sources of confusion, causing developers to ask "Should I use
<b>
or
<strong>
? Don't they both do the same thing?"
Not exactly. The
<strong>
element is for content that is of greater importance, while the
<b>
element is used to draw attention to text without indicating that it's more important.
It may help to realize that both are valid and semantic elements in HTML5 and that it's a coincidence that they both have the same default styling (boldface) in most browsers (although some older browsers actually underline
<strong>
). Each element is meant to be used in certain types of scenarios, and if you want to bold text simply for decoration, you should instead actually use the CSS
font-weight
特性。
The intended meaning or purpose of the enclosed text should be what determines which element you use. Communicating meaning is what semantics are all about.
Adding to the confusion is the fact that while HTML 4 defined
<strong>
as simply indicating a stronger emphasis, HTML 5 defines
<strong>
as representing "strong importance for its contents." This is an important distinction to make.
While
<em>
is used to change the meaning of a sentence as spoken emphasis does ("I
love
carrots" vs. "I love
carrots
"),
<strong>
is used to give portions of a sentence added importance (e.g., "
Warning!
这为
very dangerous.
") Both
<strong>
and
<em>
can be nested to increase the relative degree of importance or stress emphasis, respectively.
<p>Before proceeding, <strong>make sure you put on your safety goggles</strong>.</p>
The resulting output:
<p><strong>Important:</strong> Before proceeding, make sure you add plenty of butter.</p>
This results in:
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
strong
|
Chrome 完整支持 1 | Edge 完整支持 12 |
Firefox
完整支持
1
注意事项
|
IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
完整支持
见实现注意事项。
<b>
element
<em>
element
font-weight
property