MakeW3web

HTML formatting Tags

HTML formatting tags are used to apply specific styles and format content within an HTML document. These tags help control the appearance and layout of text on a web page.

Here are some commonly used HTML formatting tags with explanations and examples:

  1. Bold: The `<strong>` and `<b>` elements are used to make text bold. The `<strong>` tag is preferred because it also indicates that the text has added importance.
<strong>This text is bold and has added importance.</strong>
<b>This text is bold.</b>
  1. Italic: The `<em>` and `<i>` elements are used to make text italic. The `<em>` tag is preferred because it also indicates that the text should be emphasized.
<em>This text is italic and should be emphasized.</em>
<i>This text is italic.</i>
  1. Underline: The `<u>` element is used to underline text. However, it's not recommended to use this tag for emphasizing text, as underlined text is often associated with hyperlinks.
<u>This text is underlined.</u>
  1. Strikethrough: The `<del>` and `<s>` elements are used to apply a strikethrough to text. The `<del>` tag is preferred because it indicates that the text has been deleted or is no longer accurate.
<del>This text has been deleted.</del>
<s>This text has a strikethrough.</s>
  1. Superscript: The `<sup>` element is used to create superscript text, often used for footnotes, citation numbers, or mathematical expressions.
E = mc<sup>2</sup> is Einstein's famous equation.
  1. Subscript: The `<sub>` element is used to create subscript text, often used for chemical formulas or mathematical expressions.
H<sub>2</sub>O is the chemical formula for water.
  1. Preformatted Text: The `<pre>` element is used to display preformatted text. This tag preserves spaces, line breaks, and indentation in the text, making it suitable for displaying code or text with a specific layout.
<pre>
  This is preformatted text.
  Spaces and line breaks are preserved.
</pre>
  1. Blockquote: The `<blockquote>` element is used to represent a section of quoted text from another source. It is often displayed as indented text with a citation.
<blockquote>
  This is a quote from another source.
  <cite>Source Name</cite>
</blockquote>

These formatting tags can be used individually or combined to style text on a web page. However, for more advanced styling and better separation of content and presentation, it is recommended to use CSS (Cascading Style Sheets) along with HTML.

Was this page helpful?