HTML text formatting elements allow you to modify the visual presentation and semantic meaning of text—including bold weight, italic slant, highlights, strikethroughs, chemical subscripts, and mathematical superscripts.
Tag |
Classification |
Description & Browser Rendering |
|---|---|---|
|
Semantic (Logical) | Marks text of high importance or urgency; rendered in bold and emphasized by screen readers. |
|
Presentational (Physical) | Draws visual attention to text without conveying extra semantic importance; rendered in bold. |
|
Semantic (Logical) | Marks emphasized stress on text that alters spoken pronunciation; rendered in italics. |
|
Presentational (Physical) | Displays text in an alternate voice or mood (e.g., technical terms, foreign phrases); rendered in italics. |
|
Semantic (HTML5) | Highlights text with a yellow background, indicating reference relevance (e.g., search results). |
|
Semantic (HTML5) | Renders smaller text used for side-comments, legal copyrights, and disclaimers. |
|
Semantic (Revision) | Marks deleted or outdated text; rendered with a strikethrough line across the characters. |
|
Semantic (Revision) | Marks newly inserted text; rendered with an underline. |
|
Typographic | Renders subscript text (lowered half a character below baseline), ideal for chemical formulas (H2O). |
|
Typographic | Renders superscript text (raised half a character above baseline), ideal for math exponents (x2). |
|
Legacy (Deprecated) | Historical tag used to set font color, size, and face. Obsolete in HTML5—use CSS instead. |
In modern HTML5, there is a crucial distinction between Physical Tags (which only affect visual appearance) and Semantic Tags (which convey meaningful structural context to search engine bots and accessibility screen readers):
<b> for stylistic keywords (like product names in an overview) without conveying urgency. Use <strong> for warnings, serious cautions, and core focal points that Google should weigh heavily for SEO.<i> for scientific binomial nomenclature (Homo sapiens), terms in other languages, or ship names. Use <em> when stress emphasis changes the verbal meaning of a sentence.
<p>This is <b>bold text</b> for visual styling.</p>
<p><strong>Warning:</strong> Do not share your password with anyone.</p>
<p>The term <i>de facto</i> is commonly used in legal discussions.</p>
<p>You <em>must</em> submit your BCA lab assignment on time!</p>
<p>Search Result: Learn <mark>HTML5</mark> at Veewom for top college grades.</p>
<p>Regular Price: <del>₹999</del> | Special Offer: <ins>₹499</ins></p>
<p>Water Chemical Formula: H<sub>2</sub>O</p>
<p>Einstein's Equation: E = mc<sup>2</sup></p>
Historically in HTML 3.2 and 4.01, webmasters used <font size="4" color="red" face="Arial">Text</font>. In modern HTML5, the <font> tag is completely deprecated and obsolete because it violates the principle of separating content (HTML) from presentation (CSS). Modern websites achieve font styling cleanly via CSS:
<!-- Modern CSS Replacement for <font> -->
<p style="color: #27ae60; font-size: 20px; font-family: 'Segoe UI', Tahoma, sans-serif;">
Veewom Modern Font Styling via CSS
</p>
Problem Statement: Create an HTML card for an electronics store showcasing a laptop. Use <strong> for the model name, <del> and <ins> for price discounts, <mark> for a festival deal badge, <sub> and <sup> for processor specs (e.g., 10th Gen), and <small> for the warranty disclaimer.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>E-Commerce Product Card - Formatting Practice</title>
</head>
<body>
<div class="deal-card">
<h2><strong>UltraBook Pro 15</strong> <mark>HOT DEAL</mark></h2>
<p>Equipped with the 12<sup>th</sup> Gen Intel Core i7 processor and 16GB RAM.</p>
<p>
Original Price: <del>₹75,000</del><br>
Festive Price: <ins><strong>₹59,990</strong></ins>
</p>
<p><small>*Terms and conditions apply. 1-year manufacturer warranty included.</small></p>
</div>
</body>
</html>
<b> and <i>) dictate the visual rendering of text without providing information about the importance of the text. Logical tags (like <strong> and <em>) define the semantic importance and role of the text, assisting search engine crawlers and screen readers.
<sub> (subscript) element positions text lowered below the normal baseline with a reduced font size, whereas <sup> (superscript) positions text raised above the normal baseline with a reduced font size.
<font> tag was deprecated because it mixed visual styling directly with markup structure, leading to repetitive code and poor website maintainability. CSS now provides centralized, maintainable styling control.
<p><strong><em>Bold and Italic</em></strong></p>). Just ensure you close the tags in reverse order of opening (LIFO - Last In, First Out).
<strong> and <em> tags to identify critical focal concepts within an article. Highlighting key terms naturally signals topical relevance to Googlebot.