Using Tags for Text Formatting - HTML

 

HTML provides several tags to format text, making it bold, italic, underlined, or even highlighted. These tags help improve readability, emphasize important content, and structure text properly.

Bold and Strong Text: <b> vs. <strong>

Both <b> and <strong> make text bold, but <strong> has semantic meaning for emphasis.

<p>This is <b>bold</b> text.</p>
<p>This is <strong>strong</strong> text.</p>
Run Code on FunProgramming

SEO Tip

Use <strong> for important keywords to improve SEO, as search engines recognize it.

Italic and Emphasized Text: <i> vs. <em>

Both <i> and <em> italicize text, but <em> adds semantic emphasis.

<p>This is <i>italic</i> text.</p>
<p>This is <em>emphasized</em> text.</p>
Run Code on FunProgramming

Fun Fact

<i> is great for styling, while <em> helps screen readers emphasize text.

Underlined Text: <u>

Use <u> to underline text (but don’t overuse it, or it might look like a hyperlink!).

<p>This is <u>underlined</u> text.</p>
Run Code on FunProgramming

Highlighting Text: <mark>

The <mark> tag highlights text like a neon marker.

<p>This is <mark>highlighted</mark> text.</p>

When to Use It?

Perfect for drawing attention to keywords or important points in an article.

Strikethrough Text: <s> and <del>

Use <s> for incorrect text and <del> for deleted content.

<p>This item is <s>out of stock</s> available now!</p>
<p>Old price: <del>$50</del> New price: $30</p>
Run Code on FunProgramming

Small Text: <small>

Reduces font size for legal disclaimers or fine print.

<p><small>Terms and conditions apply.</small></p>
Run Code on FunProgramming

Superscript and Subscript: <sup> and <sub>

These are great for mathematical formulas or footnotes.

<p>H<sub>2</sub>O is water.</p>
<p>E=mc<sup>2</sup></p>
Run Code on FunProgramming

Fun Facts About Text Formatting

  1. <b> and <i> were used more in older HTML versions, but <strong> and <em> are now preferred for accessibility and SEO.
  2. <mark> is like the highlighter of the internet!
  3. <small> text can make anything sound like fine print.

Conclusion

Text formatting in HTML helps improve readability, accessibility, and SEO. Use the right tags to structure your content effectively. Happy coding! 

Post a Comment

0 Comments