Text Formatting Tags
HTML provides tags for formatting text without using CSS to increase its visual appeal.
<b> - Bold text:
The HTML <b> tag gives text a bold appearance. CSS font-weight property also gives us the option for making the text bold.
Eg: <p> <b>HTML</b> is a markup language. </p>
Here the text 'HTML' will appear in bold.
Output:
HTML is a markup language.
<strong> - Important text: The HTML <strong> tag gives text a strong emphasis and the text is displayed as bold. This tag is used to highlight the importance of the text.
Eg: <strong>This is an important text!</strong>
Output:
This is an important text!
<i> - Italic text: The HTML <i> element represents a range of text that is different from the normal text to indicate technical terms or similar expressions in italics.
Eg: <p>The <i>Titanic</i> sank in 1912.</p>
Output:
The Titanic sank in 1912.
<em> - Emphasised text: The HTML <em> tag is used to emphasise a particular text within a sentence. Content inside this tag will be displayed in italics.
Eg: <p> The <em>Titanic</em> sank in 1912. </p>
Output:
The Titanic sank in 1912.
<mark> - Marked text: The HTML <mark> tag is used to highlight the text (usually with a background colour) inside another element such as a paragraph, list, or heading.
Eg: <p> The <mark>Titanic</mark> sank in 1912. </p>
Output:
The Titanic sank in 1912.
<small> - Smaller text: The HTML <small> element represents smaller texts, like copyright and legal text.
Eg: <small> © 2022 beginwebprogramming.com </small>
Output: © 2022 beginwebprogramming.com
<del> - Deleted text: The HTML <del> represents a text that has been deleted from the document. Browsers will strike a line through the deleted text.
Eg: <p> Colour of the leaves are <del>green</del> yellow now. </p>
Output:
Colour of the leaves are green yellow now.
<ins> - Inserted text: The HTML <ins> element represents a range of text that has been inserted to a document. Browser highlights the text with underline.
Eg: <p> Colour of the leaves are <del>green</del> <ins>yellow</ins> now. </p>
Output:
Colour of the leaves are green yellow now
<sub> - Subscript text: The HTML <sub> is used to show a text as a subscript of a normal text. Subscripts are rendered with a lowered baseline using smaller text.
Eg: H<sub>2<sub>O
Output: H2O
<sup> - Superscript text: The HTML <sub> is used to show a text as a superscript of a normal text. Superscript text appears above the normal line.
Eg: X<sup>2<sup>+5 = 30
Output: X2+5 = 30
Heading Tags
HTML defines six levels of headings. HTML <h1>, <h2>, <h3>, <h4>, <h5> and <h6> tags make it easier for people and search engines to understand the general content of a page. Heading tags define a page’s main header (<h1>) and the sub-headers (<h2>-<h6>) for other contents inside the page. Contents inside the heading tags appear in bold format on the browser.
Eg:
<h1>Heading H1</h1>
<h2>Heading H2</h2>
<h3>Heading H3</h3>
<h4>Heading H4</h4>
<h5>Heading H5</h5>
<h6>Heading H6</h6>
Output: