HTML provides various elements to format text, making it easier to structure and present content on the web. Some of the most commonly used HTML formatting elements are as follows:
Headings: Headings are used to create titles or sub-titles in a document. There are six levels of headings, ranging from H1 to H6. H1 is the largest and most important heading, while H6 is the smallest.
<h1>This is an H1 heading</h1> <h2>This is an H2 heading</h2> <h3>This is an H3 heading</h3> <h4>This is an H4 heading</h4> <h5>This is an H5 heading</h5> <h6>This is an H6 heading</h6>
Paragraphs: Paragraphs are used to define blocks of text. The
<p> tag is used to define a paragraph in HTML.
<p>This is a paragraph of text.</p> <p>This is another paragraph of text.</p>
Bold and italic text: To make text bold, the
<strong> tag is used. To make text italic, the
<em> tag is used.
<p>This is a <strong>bold</strong> text.</p> <p>This is an <em>italic</em> text.</p>
Lists: Lists are used to display items in a specified order. There are two types of lists in HTML – unordered and ordered. Unordered lists are represented by the
<ul> tag, while ordered lists are represented by the
<ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> <ol> <li>First item</li> <li>Second item</li> <li>Third item</li> </ol>
Links: Links are used to connect different pages or websites. The
<a> tag is used to create a hyperlink in HTML.
<a href="https://www.firehousemouse.com" alt="description of what the link is pointing to"> Visit firehousemouse.com </a>
Images: Images are used to display pictures on a web page. The
<img> tag is used to insert an image in HTML.
<img src="image.jpg" alt="description of the image">
Horizontal rule: The
<hr> tag is used to create a horizontal rule to separate content on a web page.
Preformatted text: The
<pre> tag is used to display preformatted text, such as code snippets.
<pre> This is an example of preformatted text </pre>