Topic 10 of 57 2. HTML Basics Interactive Tutorial

HTML Text Formatting Tags: Complete Guide with Examples

12 mins read Last updated: 12 Nov 2026 16,100 views

Topic Overview & Definition

Key Question
What are the essential text formatting tags in HTML and how do they differ?
Direct Answer & Overview
HTML offers specialized text formatting tags to indicate semantic meaning and visual styling. Key tags include and (boldness), and (italic emphasis), (highlighting), (fine print), (strikethrough deleted text), (inserted text), (subscript), and (superscript).

Comprehensive Step-by-Step Concepts

1) Semantic vs Visual Formatting: Semantic tags (, , , ) convey meaningful context to assistive screen readers and search engines. Purely visual tags (, ) change visual appearance without altering semantic priority. 2) Highlighting with : The tag represents text marked or highlighted for reference or notation purposes, traditionally styled with a yellow background. 3) Deleted and Inserted Content: renders text with a strikethrough line to denote removed information; renders text with an underline to represent newly inserted text, commonly used in legal documents and document revision histories. 4) Mathematical and Scientific Text: positions text slightly below the baseline (e.g. H2O for chemical formulas); positions text slightly above the baseline (e.g. E = mc2 or footnote citations). 5) Fine Print with : The element semantically denotes disclaimers, copyright notices, and legal caveats, rendering text one font size smaller.

Runnable HTML5 Code Example & Practical Implementation

index.html
HTML Editor
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Text Formatting Showcase</title>
</head>
<body>
    <article>
        <h2>Text Formatting in Action</h2>
        
        <p>Pay close attention to <strong>critical security updates</strong>.</p>
        <p>Scientific formula for water is H<sub>2</sub>O and energy is E = mc<sup>2</sup>.</p>
        
        <p>Special promotion: <del>$99.99</del> <ins>$49.99</ins> today only!</p>
        
        <p>Search results often <mark>highlight matching keywords</mark> in the snippet.</p>
        
        <footer>
            <p><small>&copy; 2026 OperateTools. Terms and conditions apply.</small></p>
        </footer>
    </article>
</body>
</html>

Key Takeaways, Best Practices & Standards

Best Practice & Standards
Prioritize semantic tags (, , ) over purely presentational ones (, ) to ensure optimal accessibility.

Common Technical & Interview Questions

Q

Q1: What is the semantic difference between and ?

A1: styles text in bold without attributing extra importance or altering voice inflection. denotes strong importance, seriousness, or urgency, causing screen readers to pronounce words with heightened emphasis.
Q

Q2: When should you use and instead of CSS text-decoration: line-through?

A2: Use and when documenting editorial document modifications, version comparisons, or price reductions where the act of insertion or deletion carries semantic meaning.
Q

Q3: Can text formatting tags be nested together?

A3: Yes, formatting tags can be nested safely (e.g., Crucial Note) as long as tags are closed in reverse order of opening.