Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

Web Development - HTML Formatting


HTML Text Formatting

HTML provides several elements for formatting text, such as making it bold, italic, highlighted, or smaller. Formatting tags help you emphasize parts of your content.


Bold and Strong Text

In HTML, to make text bold, you can use either <b> or <strong>.

  • <b> - makes text bold (visual only)
  • <strong> - indicates important text (semantic)

Example

Bold and strong text:

<p>This is <b>bold</b> text.</p>
<p>This is <strong>important</strong> text.</p>
Try it Yourself »

Italic and Emphasized Text

To make text italic, you can use either <i> or <em>.

  • <i> - italic text (visual only)
  • <em> - emphasizes text (semantic meaning)

Example

Italic and emphasized text:

<p>This is <i>italic</i> text.</p>
<p>This is <em>emphasized</em> text.</p>
Try it Yourself »

Tip: Use <em> and <strong> for meaning, not just appearance. Screen readers give them emphasis for accessibility.


Marked, Small, Deleted, and Inserted Text

HTML includes tags for special text effects like highlighting, reducing size, showing deletions, and insertions:

Example

Various text formats:

<p>This is <mark>highlighted</mark> text.</p>
<p>This is <small>smaller</small> text.</p>
<p>This is <del>deleted</del> text.</p>
<p>This is <ins>inserted</ins> text.</p>
Try it Yourself »
  • <mark> - highlights text (like a marker)
  • <small> - makes text smaller
  • <del> - shows deleted text (usually with a line through it)
  • <ins> - shows inserted text (usually underlined)

Subscript and Superscript

The <sub> and <sup> elements are used for subscript and superscript text:

Example

Subscript and superscript text:

<p>Water formula: H<sub>2</sub>O</p>
<p>E = mc<sup>2</sup></p>
Try it Yourself »

Combining Formatting

You can combine multiple formatting tags to style and emphasize text in different ways:

Example

Combining tags:

<p>This is <b><i>bold and italic</i></b> text.</p>
<p>This is <em><mark>important and highlighted</mark></em> text.</p>
Try it Yourself »

Tip: Be careful not to overuse formatting - too many styles can make text harder to read.


Summary

  • <b> and <strong> - bold or important text
  • <i> and <em> - italic or emphasized text
  • <mark> - highlighted text
  • <small> - smaller text
  • <del> and <ins> - deleted and inserted text
  • <sub> and <sup> - subscript and superscript

Now that you know the basic HTML elements, let's put them together in a small hands-on example. In the next section, you will build a simple profile page using only the tags you've learned so far.

Next » HTML Project: Simple Page


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.