Skip to main content

How to Make Text Bold in HTML with strong

· 3 min read
Jagdish Kumawat
Founder @ Dewiride

Wrap words in <strong> and the browser shows them in bold. Bold is how browsers show what strong means: that the words are important.

Syntax​

Syntax
<strong><text></strong>
PartWhat it does
<strong>Marks <text> as important. Browsers show it in bold.
<text>The words to mark, from one word to a few sentences.
</strong>Ends the important part.

MDN's strong page describes the element as marking content of strong importance, seriousness or urgency.

The Example​

The example is a one-line notice, with the word Note: marked as important.

Step 1: Write the Code​

Create a file named index.html in a text editor, such as Visual Studio Code:

index.html, an HTML page with one paragraph: the word Note: inside a strong element, followed by the office is closed on Friday.

index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Note</title>
</head>
<body>
<p><strong>Note:</strong> the office is closed on Friday.</p>
</body>
</html>

Step 2: Open It in a Browser​

Double-click index.html. It opens in your browser:

The page in Chromium: the sentence Note: the office is closed on Friday., with Note: in bold.

The screenshot comes from Chromium 159, the open-source browser that Chrome is built on.

What Happened​

  • Note: is bold. Chromium gave the strong element a font weight of 700, the weight for bold.
  • The rest of the paragraph stayed at 400, the normal weight, because </strong> ended the bold part right after Note:.

Common Mistakes​

MistakeWhat happensDo this instead
Forgetting </strong>The bold doesn't stop where the paragraph ends: the next paragraph, Have a nice weekend., came out bold tooClose it right after the important words
Using strong only to make text look boldThe words are marked as important although they aren'tUse b for text that only needs to stand out, or CSS's font-weight

Troubleshooting​

SymptomLikely causeFix
Everything after a word is bold, even in later paragraphsA strong isn't closedAdd </strong> after the important words
The words aren't boldThey're outside the strong elementMove them between <strong> and </strong>

FAQ​

What's the difference between strong and b?​

They look the same: Chromium gave b a font weight of 700 too. The difference is the meaning. MDN's b page says b draws attention to words without marking them as more important, while strong marks them as important.

Can I make text bold with CSS instead?​

Yes: font-weight: bold gave a span element a weight of 700, the same as strong. Use CSS when the text should only look bold.

Can strong go inside a heading or a list item?​

Yes. strong works inside any element that holds text.

Conclusion​

strong marks important words, and browsers show them in bold. Close it with </strong> right after the words, and use b or CSS when the text is only meant to look bold.

Additional Resources​