0
0
HTMLmarkup~5 mins

Bold and italic text in HTML

Choose your learning style9 modes available
Introduction

We use bold and italic text to make some words stand out or show emphasis in writing.

To highlight important words in a paragraph.
To show titles or headings that need attention.
To emphasize a word when telling a story.
To mark foreign words or phrases in a sentence.
To make instructions clearer by stressing key steps.
Syntax
HTML
<strong>bold text</strong>
<em>italic text</em>

tags make text bold and mean strong importance.

tags make text italic and mean emphasis.

Examples
This text will appear thicker and darker to stand out.
HTML
<strong>This text is bold</strong>
This text will slant to the right to show emphasis.
HTML
<em>This text is italic</em>
You can mix bold and italic in the same sentence.
HTML
<p>This is <strong>bold</strong> and this is <em>italic</em>.</p>
Sample Program

This page shows how bold and italic text looks in a browser. The bold text is thicker, and the italic text slants.

HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Bold and Italic Text Example</title>
</head>
<body>
  <h1>Welcome to My Page</h1>
  <p>This is a <strong>bold</strong> word and this is an <em>italic</em> word.</p>
  <p><strong>Important:</strong> Always use semantic tags for better accessibility.</p>
</body>
</html>
OutputSuccess
Important Notes

Use and tags instead of and for better meaning and accessibility.

Screen readers can tell the difference and help people understand the emphasis.

Browsers show bold text thicker and italic text slanted by default.

Summary

Bold text uses the <strong> tag to show importance.

Italic text uses the <em> tag to show emphasis.

These tags help readers and devices understand the meaning, not just the style.