HTML Text Formatting: More Than Just Looks

Learn to make your text stand out by adding importance, emphasis, code, and more.

Lesson ProgressStep 1 of 9

This text is important.

I really want to go.

Semantic: Important! Visual: Bold

This is both!

Here are the search results.

0 EXP

Welcome! Plain text is fine, but let's learn how to make your words stand out with semantic HTML tags.

Importance (`<strong>`) & Emphasis (`<em>`)

These are the two most important semantic formatting tags. They tell the browser *why* the text is different, not just *how* it should look.

  • `<strong>`: Use this for content that has strong importance, seriousness, or urgency. Think of warnings or critical keywords. Browsers render it as bold.
  • `<em>`: Use this to add emphasis to a word or phrase, which subtly changes the meaning of a sentence. Browsers render it as italic.
<p><strong>Warning:</strong> Do not proceed.</p>
<p>I <em>really</em> do not like green eggs.</p>

System Check

Which tag is semantically correct for a safety warning?

Advanced Holo-Simulations

0 EXP

Log in to unlock these advanced training modules and test your skills.


Achievements

🎨
Formatter Adept

Use <strong>, <em>, and <mark> correctly in one document.

🧠
Semantic Stylist

Correctly distinguish semantic importance from visual style.

Nested
Nesting Ninja

Prove your mastery of correctly nesting formatting tags.

Mission: The Semantic Paragraph

Create a single paragraph (`<p>`) that contains:important text, emphasized text, and highlighted text. Our AI assistant will provide real-time feedback.

A.D.A. Feedback:

> Awaiting input...

Challenge: Order by Semantic Meaning

Drag the elements into order from **most semantic meaning** to **least semantic meaning (purely visual)**.

<em> (Emphasis)
<strong> (Importance)
<b> (Visual Bold)

Challenge: Complete the Nested Syntax

Fill in the missing parts to correctly nest an `<em>` tag inside a `<strong>` tag.

<p>This is <><>both<><>.</p>

Consult A.D.A.

Unlock with Premium

Community Holo-Net

Peer Project Review

Submit your "Semantic Paragraph" project for feedback from other Net-Runners.

More Than Just Looks: The Deep Dive into Semantic Text

In the early days of the web, if you wanted text to be bold, you used <b>. If you wanted it italic, you used <i>. The web has since evolved. The most important shift in modern HTML is the focus on **semantics**: using tags to describe the *meaning* and *role* of content, not just its visual appearance.

The "Big Two": Importance vs. Emphasis

This is the most critical distinction to learn. While they may look identical in a browser, their meaning is worlds apart.

  • <strong> vs. <b>:
    <strong> marks text as having "strong importance, seriousness, or urgency." Use it for warnings, key phrases in a document, or labels that need to be understood quickly. A screen reader might use a more forceful tone for this text.
    <b> (Bring Attention To) is purely presentational. It makes text bold without implying any extra importance. Its use is now limited to cases where you want visual boldness *without* semantic meaning, like a product name in a review.
  • <em> vs. <i>:
    <em> (Emphasis) is used to stress a word or phrase, thereby changing the meaning of the sentence (e.g., "I *really* didn't say that.").
    <i> (Idiomatic Text) is for text that's in a different "voice" or mood, such as a foreign word (bon appétit), a technical term, a thought, or a ship's name. It doesn't add emphasis.

**Why does this matter?** For **accessibility**, screen readers can change their intonation for `<strong>` and `<em>`. For **SEO**, search engines like Google give more weight to keywords inside `<strong>` than `<b>`.

Edits and Annotations: Showing Change

HTML provides tags specifically for marking up edits and highlights.

<del> (Deleted Text)

Renders as strikethrough. It indicates that content has been removed from the document.

<ins> (Inserted Text)

Renders as underlined. It indicates that content has been added to the document.

<mark> (Marked Text)

Renders as highlighted. It represents text that is marked or highlighted for reference, like search results on a page.

Technical & Computer-Related Text

A common point of confusion is the set of tags for displaying code and technical concepts. They each have a distinct purpose.

  • <code>: For a small, inline snippet of computer code. Example: document.getElementById().
  • <pre>: For a multi-line block of pre-formatted text (usually code). It preserves whitespace (spaces and line breaks).
    function hello() {
      console.log("Hi!");
    }
  • <kbd>: For user keyboard input. Example: Press Ctrl + C.
  • <samp>: For sample output from a computer program. Example: File not found.
  • <var>: For a variable in a mathematical expression or programming context. Example: x + y = 10.

Typographical and Positional Text

Finally, some tags are for specific typographical conventions.

  • <sub> & <sup>: Subscript and superscript text. These are semantic for things like chemical formulas (H2O) and math (E = mc2).
  • <small>: For "small print" or side comments, like copyright notices or legal disclaimers. It represents content that is less important.
  • <abbr>: For abbreviations or acronyms. Use the `title` attribute to provide the full expansion (e.g., HTML).
Key Takeaway: Before you reach for a tag, ask "What does this text *mean*?" Is it important? Is it a code snippet? Is it a legal disclaimer? Choosing the right semantic tag makes your site more accessible, better for SEO, and easier for other developers to understand.

Text Formatting Glossary

<strong>
Indicates strong importance, seriousness, or urgency. Renders as bold. (Semantic)
<em>
Adds emphasis to a word, changing the meaning of a sentence. Renders as italic. (Semantic)
<b>
"Bring Attention To" tag. Makes text bold without implying importance. (Presentational)
<i>
"Idiomatic Text" tag. For text in a different voice (e.g., foreign words, thoughts). Renders as italic. (Presentational)
<mark>
Highlights text for reference, like a search result or a passage you'd mark with a highlighter. (Semantic)
<ins> & <del>
Inserted and Deleted text. Used to mark up edits or revisions to a document. Renders as underlined and strikethrough. (Semantic)
<sub> & <sup>
Subscript and Superscript. For typographical conventions like H2O or E=mc2. (Semantic)
<small>
For "small print" or side comments, like copyright information or legal disclaimers. (Semantic)
<code>
For inline snippets of computer code.
<pre>
For blocks of pre-formatted text, where whitespace (spaces, line breaks) is preserved. Almost always used to wrap a `<code>` block.
<kbd>
For text representing user keyboard input (e.g., "Press <kbd>Enter</kbd>").
<q> & <blockquote>
For quotations. `<q>` is for short, inline quotes (adds quotes automatically), and `<blockquote>` is for long, multi-line quotes (indents the block).
<abbr>
For abbreviations or acronyms. Use `title="Full Text"` to provide the expansion.

Credibility and Trust

About the Author

Author's Avatar

Todotutorial Team

Passionate developers and educators making programming accessible to everyone.

This article was written and reviewed by our team of web development experts, who have years of experience teaching HTML and building robust and accessible web applications.

Verification and Updates

Last reviewed: October 2025.

We strive to keep our content accurate and up-to-date. This tutorial is based on the latest HTML5 specifications and is periodically reviewed to reflect industry best practices.

External Resources

Found an error or have a suggestion? Contact us!