Dular SharmaDular SharmaDular Sharma
(Monday - Saturday)
Dular SharmaDular SharmaDular Sharma

Chapter 5. Formatting Text


In addition to creating elements, HTML offers tags for in-text formatting, enabling the application of specific text-related styles to text segments. This section exemplifies HTML text formatting features like highlighting, bolding, underlining, subscript, and stricken text.

Introduced in HTML5, the <mark> element is utilized to emphasize or highlight text within a document, typically to denote relevance in another context. For instance:

<p>Here is the example of <mark>MARKED TEXT</mark> in the paragraph.</p>

Highlighting is often represented by black text on a yellow background, although this can be customized using CSS.

Bold, Italic, and Underline:

Bold Text:
To emphasize text, utilize the <strong> OR <b> tags, each carrying semantic differences:

<strong> This is BOLD text</strong> //OR <b>This is BOLD TEXT </b>

The distinction lies in semantics; <strong>indicates fundamental importance, while <b> simply bolds text without implied significance.

Italic Text:
Italicized text is achieved using<em> or <i> tags, with <em> denoting extra emphasis:

<em> This is Italicized text.</em> //OR <i>this is Italicized text. </i>

The choice between <em> and <i> depends on the intended emphasis or stylistic convention.

Underlined Text:
Although deprecated in HTML4, the <u>element was reintroduced in HTML5 for alternate purposes, such as marking misspelled words:

<p>This is <u> underlined </u> text.</p>

The <abbr>tag designates an abbreviation, with the optional title attribute providing its full description:

<p>Hover over to see full form of <abbr title="Hypertext Markup Language">HTML</abbr>!</p>

Inserted, Deleted, or Stricken Text:
Text can be marked as inserted using <ins>, deleted using <del>, or struck through using <s>:

<ins>This is Inserted Text</ins> <del>This is Deleted Text</del> <s>This is Struck-through text</s>

Superscript and Subscript:
Use <sup> and <sub> tags to position text upward or downward respectively:

<p> This is <sup>superscript text</sup>, This is <sub>subscript text</sub>

Previous Post
Newer Post

Leave A Comment

Need Help?