Formatting in HTML

Formatting in HTML refers to the process of arranging and styling text and other content on a webpage. HTML provides a number of tags and attributes that can be used to format text, including headings, paragraphs, lists, and more.


One of the most basic formatting tags in HTML is the <p> tag, which is used to create paragraphs of text. The p tag automatically adds a line break before and after the text, creating a distinct block of text.

<p>This is a paragraph text</p>
<p>This is another paragraph text</p>


List of Formatting Elements:

  • <br/>: Line break.
  • <b>: Bold text
  • <strong>: Important text
  • <i>: Italic text
  • <u>: unarticulated text
  • <em>: Emphasized text
  • <mark>: Marked text
  • <small>: Smaller text
  • <del>: Deleted text
  • <ins>: Inserted text
  • <sub>: Subscript text
  • <sup>: Superscript text


HTML <br/> Element.

The <br/ > element is used to insert a single-line break and mainly use for writing addresses or poems.

Example:
<p>This is paragraph for showing example of <br /> line break.</p>
Output:
line break HTML example

HTML <b> and <strong> Element.

Both are used to define bold text where <b> element is used to define bold text without importance and <strong> element is used to define bold text with greater importance.

Example:
<p>This is simple text</p>
<p><b>This is a bold text</b></p>
<p><strong>This is a bold and important text</strong></p>
Output:
bold text in HTML

HTML <i>, <u> and <em> Elements.

The <i> tag in HTML is used to represent a portion of text in italic. It is used to show voice, technical terms, or part of the text written in another language. 

Example:
<p>This is a simple paragraph</p>
<p><i>This is an italic text</i></p>
Output:
italic text in HTML


The <u> tag in HTML stands for underline and is used to underline the text. It is generally used to underline misspelled words in a paragraph.

Example: 
<p>This is a <u>simple</u> paragraph</p>
Output:
underline text in HTML

The <em> tag in HTML stands for emphasized text and the content inside this is displayed in italic font.

Example: 
<p>This is an simple paragraph</p>
<p><em>This is an emphasized paragraph</em></p>
Output:
emphasized text in HTML

HTML <small> Element.

The <small> tag in HTML is used to define smaller text. 

Example: 
<p>This is a simple paragraph</p>
<p><small>This is smaller paragraph</small></p>
Output:
small text in HTML

HTML <mark> Element

The <mark> HTML tag is used to highlight a portion of text.

Example:
<p>The speed limit of this road is <mark>40KM/hr</mark>.</p>
Output:
highlight text in HTML


HTML <del> Element

The <del> tag in HTML is used to represent the portion of text that has been deleted. 

Example:
<p>I love playing <del>cricket</del> football</p>
Output:
strike text in HTML

HTML <sub> Element

The <sub> tag in HTML is used to create subscript text, which is a text that is slightly smaller and appears slightly lower than the surrounding text. Subscript text is often used in mathematical or scientific equations to indicate a value or variable that is to be used as the base of power or index.

Example:
<p>This is an equation: x<sub>1</sub> + x<sub>2</sub> = x<sub>3</sub></p>
Output:
subscript text in HTML

HTML <sup> Element

The <sup> tag in HTML is used to create superscript text, which is text that is slightly smaller and appears slightly higher than the surrounding text. Superscript text is often used in mathematical or scientific equations to indicate exponents, footnotes, or other similar uses.

Example:
<p>This is an equation: x<sup>2</sup> + y<sup>2</sup> = z<sup>2</sup></p>
Output:
subscript text in HTML


⚡ Please share your valuable feedback and suggestion in the comment section below or you can send us an email on our offical email id ✉ algolesson@gmail.com. You can also support our work by buying a cup of coffee ☕ for us.

Similar Posts

No comments:

Post a Comment


CLOSE ADS
CLOSE ADS