HTML Text Formatting | Headings - Paragraphs - Bold and Strong - Superscrip - Some common HTML elements for text formatting

HTML Text Formatting:`

In HTML, text formatting can be achieved using various elements and attributes. 

Here are some common HTML elements for text formatting:

1. Headings (`<h1>` to `<h6>`):
Headings are used to define headings in a document.
The `<h1>` element represents the highest level of heading, and `<h6>` represents the lowest.

    html
    <h1>This is Heading 1</h1>
    <h2>This is Heading 2</h2>
    <!-- ... -->
    <h6>This is Heading 6</h6>

Headings - Paragraphs - Bold and Strong - Superscrip - Some common HTML elements for text formatting
HTML Text Formatting

2. Paragraphs (`<p>`):

The `<p>` element is used to define paragraphs.

    html
    <p>This is a paragraph.</p>

3. Bold (`<b>`) and Strong (`<strong>`):

The `<b>` element is used for bold text, and `<strong>` is used to give strong importance to the enclosed text.

    html
    <b>This is bold text</b>
    <strong>This is strong text</strong>

4. Italic (`<i>`) and Emphasis (`<em>`):

The `<i>` element is used for italic text, and `<em>` is used to emphasize the enclosed text.

    html
    <i>This is italic text</i>
    <em>This is emphasized text</em>

5. Underline (`<u>`):

The `<u>` element is used to underline text.

    html
    <u>This is underlined text</u>

6. Strikethrough (`<s>`, `<strike>`, `<del>`):

These elements are used to create strikethrough text.

    html
    <s>This is strikethrough text</s>
    <strike>This is strikethrough text</strike>
    <del>This is deleted text</del>

7. Superscript (`<sup>`) and Subscript (`<sub>`):

`<sup>` is used for superscript text, and `<sub>` is used for subscript text.

    html
    x<sup>2</sup> (x squared)
    H<sub>2</sub>O (water)

8. Inline Code (`<code>`):

The `<code>` element is used to define a piece of computer code.

    html
    <code>console.log('Hello, World!');</code>
    

These are just a few examples of HTML elements for text formatting. The choice of element depends on the semantic meaning and intended styling. Additionally, CSS (Cascading Style Sheets) can be used to further customize the appearance of text.
ShowHideComments