What is HTML Formatting? #
HTML formatting refers to the use of specific HTML tags to highlight, style, and structure text so it is easier to read and understand. It helps:
- Emphasize important information
- Indicate styling meaning (e.g., bold, italic, underline)
- Show special text formats like code, quotes, or superscripts
Formatting can be done using HTML tags directly or combined with CSS for better design control.
Why Formatting Is Important #
- Readability – Well-formatted content is easier to scan.
- Emphasis – Draws attention to important points.
- Accessibility – Screen readers understand semantic tags better.
- SEO Benefits – Proper formatting helps search engines understand page structure.
Common HTML Formatting Tags with Examples #
Here is a list of important HTML formatting tags:
Tag | Description | Example |
---|---|---|
<b> | Bold text (non-semantic) | <b>Important Text</b> → Important Text |
<strong> | Bold text with strong importance (semantic) | <strong>Warning</strong> → Warning |
<i> | Italic text (non-semantic) | <i>Italic Style</i> → Italic Style |
<em> | Emphasized text (semantic italics) | <em>Note</em> → Note |
<u> | Underlined text | <u>Underlined</u> → Underlined |
<mark> | Highlighted text | <mark>Highlight</mark> → Highlight |
<small> | Smaller text | <small>Small Print</small> |
<del> | Deleted (strikethrough) text | <del>Old Price</del> → |
<ins> | Inserted text (usually underline) | <ins>Added</ins> |
<sub> | Subscript text | H<sub>2</sub>O → H₂O |
<sup> | Superscript text | X<sup>2</sup> → X² |
<pre> | Preformatted text (keeps spaces & line breaks) | <pre> Line 1 Line 2</pre> |
<code> | Inline code snippet | <code>print("Hello")</code> |
<blockquote> | Quotation block | <blockquote>Citation</blockquote> |
Semantic vs. Non-Semantic Formatting Tags #
- Semantic tags (like
<strong>
,<em>
) tell browsers and search engines the meaning of the text for accessibility. - Non-semantic tags (like
<b>
,<i>
) only affect visual style without implying importance.
Example:
filename.html
Copy to clipboard
<p><strong>Strong:</strong> This is important text for readers and SEO.</p>
<p><b>Bold:</b> This just makes text bold visually.</p>
Example: HTML Formatting in Action
filename.html
Copy to clipboard
<!DOCTYPE html>
<html>
<head>
<title>HTML Formatting Example</title>
</head>
<body>
<h1>HTML Formatting Demo</h1>
<p>This is a <strong>very important</strong> message.</p>
<p><em>Use italics</em> for emphasis.</p>
<p>Water formula is H<sub>2</sub>O and area formula is X<sup>2</sup>.</p>
<p>Here is some <mark>highlighted text</mark>.</p>
<p>Old price: <del>$50</del> New price: <ins>$30</ins></p>
<pre>
Preformatted text example
Keeps spaces and breaks.
</pre>
</body>
</html>
Best Practices for Text Formatting #
- Prefer semantic tags (
<strong>
,<em>
) for meaning and SEO benefits. - Use CSS for styling where possible, and HTML formatting tags for meaning.
- Avoid excessive formatting — too many bolds/italics can reduce readability.
- Use
<mark>
for highlighting important updates in blogs or news. - For code samples, combine
<code>
and<pre>
for better readability.
Summary #
HTML Formatting helps make text clear, accessible, and visually appealing.
By using semantic tags properly, you improve both user experience and SEO.
Key Takeaways:
- Use
<strong>
and<em>
over<b>
and<i>
for meaningful emphasis. - Combine formatting tags with CSS for the best results.
- Use formatting for structure, not decoration alone.