我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
Summary
The HTML Strong Element (<strong>
) gives text strong importance, and is typically displayed in bold.
Usage context
Content categories | Flow content, phrasing content |
Permitted content | Phrasing content |
Tag omission | None, must have both a start tag and an end tag |
Permitted parent elements | Any element that accepts phrasing content, or any element that accepts flow content |
Normative document | HTML5, section 4.6.3; HTML 4.01, section 9.2.1 |
Attributes
This element only includes the global attributes.
DOM Interface
This element implements the HTMLElement
interface.
Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement
interface for this element.
Example
<p>When doing x it is <strong>imperative</strong> to do y before proceeding.</p>
Result
When doing x it is imperative to do y before proceeding.
Bold vs. Strong
It is often confusing to new developers why there are so many ways to express the same thing on a rendered website. Bold and Strong are perhaps one of the most common. Why use <strong></strong> vs <b></b>? You have to type a whole lot more with strong and it produces the exact same result, right?
Perhaps not; strong is a logical state, and bold is a physical state. Logical states separate presentation from the content, and by doing so allow for it to be expressed in many different ways. Perhaps instead of rendering some text as bold you want to render it red, or a different size, or underlined, or whatever. It makes more sense to change the presentational properties of strong than it does bold. This is because bold is a physical state; there is no separation of presentation and content, and making bold do anything other than bold text would be confusing and illogical.
It is important to note that <b></b> does have other uses, when one wants to draw attention without increasing importance.
Emphasis vs. Strong
While in HTML4, Strong simply indicated a stronger emphasis, in HTML5, the element is described as representing "strong importance for its contents." This is an important distinction to make. While Emphasis is used to change the meaning of a sentence ("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 Emphasis can be nested to increase the relative degree of importance or stress emphasis, respectively.