Formatting Elements
Enhance the Readability and Presentation of Text
Formatting elements play a crucial role in shaping the visual appeal and clarity of your HTML content. They allow you to emphasize key information, highlight important sections, and present data in an organized manner. By understanding and using these elements effectively, you can enhance the user experience and make your web pages more engaging and informative.
Do You Know?
Formatting elements enhance the readability and presentation of text within your HTML documents, making it easier for users to understand and engage with your content.
Let's explore the most common HTML formatting elements:
Strong/b
The <strong>
and <b>
tags are used to represent text that is important or needs to stand out. They are semantically equivalent, meaning they have the same meaning for the browser. However, <strong>
conveys a greater level of importance than <b>
. By default, both tags render text in bold.
<p>This text is <strong>very important</strong></p>
Italic/em
The <em>
and <i>
tags are used to represent text that is emphasized or stressed. Like <strong>
and <b>
, they are semantically equivalent, but <em>
implies a stronger emphasis than <i>
. By default, both tags render text in italic.
<p>This is an <em>important point</em> to note.</p>
Mark
The <mark>
tag is used to highlight text, typically used to draw attention to a particular piece of information. By default, text within <mark>
is rendered with a yellow background.
<p>The <mark>weather</mark> forecast is sunny today.</p>
Small
The <small>
tag is used to render text in a smaller font size. It can be used to display disclaimers, copyright notices, or other small text.
<p><small>Copyright © 2023</small></p>
Del - ins
The <del>
and <ins>
tags are used to indicate deleted and inserted text, respectively. These are primarily used to display changes made to a document.
<p>This is the original text. <del>Incorrect data</del><ins>Corrected data</ins></p>
Sub - sup
The <sub>
and <sup>
tags are used to render text as subscript and superscript, respectively. These are commonly used for scientific notation, chemical formulas, and footnotes.
<p>The chemical formula for water is H<sub>2</sub>O.</p>
Summary
- Formatting elements enhance the readability and presentation of text.
<strong>
/<b>
for bold text,<em>
/<i>
for italic text.<mark>
highlights text,<small>
renders smaller font size.<del>
for deleted text,<ins>
for inserted text.<sub>
for subscript,<sup>
for superscript.