Formatting for HTML Text

Numerous elements in HTML can be used to give text a specific meaning.

Example:

<!DOCTYPE html>
<html>

<body>

   <p><b>This text is bold</b></p>

   <p><i>This text is italic</i></p>

   <p>This is<sub> subscript</sub> and <sup>superscript</sup></p>

</body>

</html>

Formatting Components in HTML

Special sorts of text can be shown using formatting elements:

<b> – Bold text

<strong> – Important text

<i> – Italic text

<em> – Emphasized text

<mark> – Marked text

<small> – Smaller text

<del> – Deleted text

<ins> – Inserted text

<sub> – Subscript text

<sup> – Superscript text


HTML <b> and <strong> tags Elements

Bold text is defined via the HTML <b> element without any additional significance.

Example:

<!DOCTYPE html>

<html>

<body>

   <p>This text is standard.</p>

   <p><b>Bold text is used here.</b></p>

</body>

</html>

Text having significant importance is defined by the HTML <strong> element. Bold text is generally used to indicate the material inside.

Example:

<!DOCTYPE html>

<html>

<body>

   <p>This text is standard.</p>

   <p><strong>This writing is significant!</strong></p>

</body>

</html>


HTML <i> and <em> Elements

A section of text can be defined in a different voice or mood using the HTML <i> element. Italic text is generally used to denote the material inside.

Advice: The <i> tag is frequently used to denote a technical term, a phrase in a different language, an idea, a ship name, etc.

Example:

<!DOCTYPE html>

<html>

<body>

   <p>This text is standard.</p>
   <p><i>This sentence has italics.</i></p>

</body>

</html>

Emphasized text is defined by the HTML <em> element. Italic text is generally used to denote the material inside.

Tip: A screen reader will emphasis the words in <em> by verbally stressing them.

Example:

<!DOCTYPE html>

<html>

<body>

   <p>This text is standard.</p>

   <p><em>This text is emphasized.</em></p>

</body>

</html>

HTML <small> Element

Smaller text is defined via the HTML <small> element.

Example :

Example:

<!DOCTYPE html>

<html>

<body>

   <p>This text is standard.</p>

   <p><small>There is small text here.</small></p>

</body>

</html>


HTML <mark> Element

The HTML <mark> element specifies the text that should be underlined or designated as special:

Example:

<!DOCTYPE html>

<html>

<body>

   <p>Don't forget to purchase <mark>milk</mark> today.</p></small></p>

</body>

</html>


MATERIALS DOWNLOAD (download)



HTML <del> Element

Text that has been removed from a document is defined with the HTML <del> element. Deleted content is typically indicated by a line through by browsers:

Example:

<!DOCTYPE html>

<html>

<body>

  <p>My favorite color is <del>blue</del> red.</p>

</body>

</html>


<ins> Element in HTML

A text that has been injected into a document is defined by the HTML <ins> element. Usually, entered text is underlined by browsers:

Example:

<!DOCTYPE html>

<html>

<body>

  <p>My preferred colors are <del>blue </del> and <ins>red</ins> respectively.</p>

</body>

</html>

<sub> Element in HTML

The <sub> element in HTML specifies subscript text. Subscript text occasionally uses a smaller font and is shown half a character below the main line. Chemical formulas, such as H2O, can be written in subscript text:

Example:

<!DOCTYPE html>

<html>

<body>

  <p>This text is <sub>subscripted</sub></p>

</body>

</html>

PROJECT DOWNLOAD (download)

Rate this post

Categorized in: