coding180 icon

Coding180

HTML Text formatting

HTML Text formatting

Tutorials > HTML > HTML Introduction


Text formatting tags help to highlight snippets of the written part of the page, either for SEO purposes or for content requirements. 
 

Below are the common elements used for text formatting in HTML 

  • b and strong for bold/strong text;
  • i and em for italics/emphasis;
  • sup and sub for superscript and subscript, respectively;
  • ins and del to indicate snippets that have been added or removed, respectively;
  • small for text smaller than the default;
  • mark for highlighted text.

Although the <b> and <strong> tag have visually identical results, they have different uses.

 The <b> tag should be used when you want to highlight something that is just visual, such as making a link more visible. 

The <strong> tag, in addition to highlighting the visual, gives a semantic highlight to the text, so if the content you want to highlight is a relevant part of the text, use the <strong> tag. 

The same goes for the <i> and <em> tags, where the <i> tag is used only for visual formatting and the <em> tag gives semantic emphasis to the text,

Below is the example that demonstrates the use of these formatting tags.

<p>Text in bold with <b>bold</b> and <strong>strong</strong>.</p>
<p>Text in italics with <i>italics<i> and <em>emphasis</em>.</p>
<p>Text <sup>superscript</sup> and <sub>subscript</sub>.</p>
<p>Text <ins>inserted</ins> and <del>deleted</del>.</p>
<p>Text <small>small</small> and <mark>highlighted</mark>.</p>

Output:


user

Robort Gabriel

Lagos, Nigeria

Freelance Web Developer, Native Android Developer, and Coding Tutor.

Skills
  • UI / UX
  • JavaScript
  • Python
  • PHP
  • Kotlin
  • Java
  • Bootrap
  • Android
  • Laravel