<strong>:非常重要的元素
<strong>
HTML 元素表示其内容具有很强的重要性、严重性或紧迫性。浏览器通常以粗体显示内容。
¥The <strong>
HTML element indicates that its contents have strong importance, seriousness, or urgency. Browsers typically render the contents in bold type.
Try it
属性
使用说明
¥Usage notes
<strong>
元素适用于 "非常重要," 的内容,包括非常严重或紧急的事情(例如警告)。这可能是对整个页面非常重要的句子,或者你可以只是尝试指出某些单词与附近的内容相比更重要。
¥The <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.
通常,该元素默认使用粗体字体呈现。但是,它不应该用于应用粗体样式;为此目的使用 CSS font-weight
属性。使用 <b>
元素引起对某些文本的注意,但不指示更高的重要性级别。使用 <em>
元素标记具有重音强调的文本。
¥Typically this element is rendered by default using a bold font weight. However, it should not be used 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.
<strong>
的另一个可接受的用途是表示段落标签,这些段落标签代表页面文本中的注释或警告。
¥Another accepted use for <strong>
is to denote the labels of paragraphs which represent notes or warnings within the text of a page.
示例
<b> 与 <strong>
¥\ vs. <strong>
新开发者常常会感到困惑,为什么在渲染的网站上有如此多种表达相同内容的方法。<b>
和 <strong>
可能是最常见的混淆来源之一,导致开发者问“我应该使用 <b>
还是 <strong>
?他们俩不都做同样的事吗?”
¥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?"
不完全是。<strong>
元素用于更重要的内容,而 <b>
元素用于引起人们对文本的注意,但不表明它更重要。
¥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.
这可能有助于认识到两者在 HTML 中都是有效的语义元素,并且巧合的是它们在大多数浏览器中都具有相同的默认样式(粗体)(尽管一些较旧的浏览器实际上在 <strong>
下划线)。每个元素都旨在用于特定类型的场景,如果你想要粗体文本进行装饰,则实际上应该使用 CSS font-weight
属性。
¥It may help to realize that both are valid and semantic elements in HTML 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 for decoration, you should instead actually use the CSS font-weight
property.
所附文本的预期含义或目的应该决定你使用哪个元素。传达意义就是语义的全部内容。
¥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.
<em> 与 <strong>
¥\ vs. <strong>
更令人困惑的是,虽然 HTML 4 将 <strong>
定义为表示更强的强调,但 HTML 5 将 <strong>
定义为代表 "其内容非常重要。",这是一个重要的区别。
¥Adding to the confusion is the fact that while HTML 4 defined <strong>
as indicating a stronger emphasis, HTML 5 defines <strong>
as representing "strong importance for its contents." This is an important distinction to make.
虽然 <em>
用于像口语强调一样改变句子的含义("我爱胡萝卜" 与 "我爱胡萝卜"),但 <strong>
用于赋予句子的某些部分额外的重要性(例如,“警告!这是非常危险的。”) <strong>
和 <em>
都可以嵌套来分别增加相对重要性程度或强调强调。
¥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! This is very dangerous.") Both <strong>
and <em>
can be nested to increase the relative degree of importance or stress emphasis, respectively.
¥Examples
基本示例
¥Basic example
<p>
Before proceeding, <strong>make sure you put on your safety goggles</strong>.
</p>
结果
¥Result
标签警告
¥Labeling warnings
<p>
<strong>Important:</strong> Before proceeding, make sure you add plenty of
butter.
</p>
结果
¥Result
技术总结
¥Technical summary
内容类别 | 流量内容, 措辞内容,可触及的内容。 |
---|---|
允许的内容 | 措辞内容. |
标签遗漏 | 没有任何;必须同时具有开始标记和结束标记。 |
允许的父级 | 任何接受 措辞内容 的元素,或任何接受 流动内容 的元素。 |
隐式 ARIA 角色 | strong |
允许的 ARIA 角色 | 任何 |
DOM 接口 | HTMLElement |
规范
¥Specifications
浏览器兼容性
¥Browser compatibility
也可以看看
¥See also
<b>
元素<em>
元素font-weight
属性