0% completed
HTML formatting refers to the methods used to style and represent text content on a webpage to enhance readability, provide semantic meaning, and improve visual appeal. By using formatting tags, you can emphasize certain parts of your text, highlight important information, or style content for aesthetic purposes.
<strong>
for important text or <em>
for emphasized text).Here’s a table of commonly used HTML formatting tags:
Tag | Description | Example |
---|---|---|
<b> | Defines bold text (no added importance). | <b>Bold Text</b> |
<strong> | Defines important text (semantically stronger than <b> ). | <strong>Important Text</strong> |
<i> | Defines italic text (no added emphasis). | <i>Italic Text</i> |
<em> | Defines emphasized text (semantically stronger than <i> ). | <em>Emphasized Text</em> |
<u> | Defines underlined text. | <u>Underlined Text</u> |
<mark> | Defines highlighted or marked text. | <mark>Highlighted Text</mark> |
<small> | Defines smaller text. | <small>Smaller Text</small> |
<del> | Defines text that has been deleted (strike-through). | <del>Deleted Text</del> |
<ins> | Defines text that has been inserted (underlined). | <ins>Inserted Text</ins> |
<sub> | Defines subscripted text. | H<sub>2</sub>O |
<sup> | Defines superscripted text. | X<sup>2</sup> |
<code> | Defines a piece of computer code. | <code>console.log('Hello')</code> |
<pre> | Preserves preformatted text (spaces and line breaks). | <pre>Preformatted Text</pre> |
The <b>
tag is used to make text bold. It provides a visual emphasis to the text.
The <i>
tag is used to make text italicized. This tag is generally used for stylistic purposes, such as indicating titles, foreign words, or technical terms.
The <mark>
tag is used to highlight text, usually with a yellow background. It is commonly used to call attention to important or relevant content.
The <del>
tag is used to indicate text that has been removed or is no longer valid. The text is displayed with a line through it.
The <sub>
tag is used to display subscript text, which is smaller and positioned below the normal text line. It is commonly used for chemical formulas or mathematical expressions.
The <sup>
tag is used to display superscript text, which is smaller and positioned above the normal text line. It is commonly used for exponents in mathematics.
Mastering these tags helps you create visually appealing and semantically meaningful text content. In the next lesson, we’ll dive into HTML Quotations, where you’ll learn how to represent quoted text effectively.
.....
.....
.....