Your Cart

Get Amazing Offers on Scripts

Get UX Support

View HTML Tutorial

HTML Text Formatting

HTML (Hypertext Markup Language) provides various elements and attributes for formatting text and controlling how text is displayed on a web page. Here are some common HTML text formatting options:

  1. Headings (<h1> to <h6>): HTML offers six levels of headings, ranging from <h1> (the highest level) to <h6> (the lowest level). These elements are used to define the hierarchical structure of content, with <h1> representing the main heading of the page and <h6> representing subheadings.

				
					<h1>This is a Heading 1</h1>
<h2>This is a Heading 2</h2>
<h3>This is a Heading 3</h3>
<h4>This is a Heading 4</h4>
<h5>This is a Heading 5</h5>
<h6>This is a Heading 6</h6>
				
			
2. Paragraphs (<p>): The <p> element is used to define paragraphs of text. It creates a line break before and after the text enclosed within it, helping to separate content into logical blocks.
				
					<p>This is a paragraph of text.</p>

				
			

3. Bold (<strong> or <b>) and Italics (<em> or <i>): You can use <strong> or <b> for bold text and <em> or <i> for italic text. <strong> and <em> carry semantic meaning, indicating the text’s importance or emphasis, while <b> and <i> are purely presentational.

				
					<p>This is <strong>important</strong> and <em>emphasized</em> text.</p>

				
			
4. Underline (<u>) and Strikethrough (<s> or <del>): <u> is used for underlining text, while <s> or <del> is used for strikethrough text. <s> and <del> often indicate deleted or outdated content.
				
					<p><u>Underlined</u> and <del>strikethrough</del> text.</p>

				
			
5. Superscript (<sup>) and Subscript (<sub>): These elements are used to format text as superscripts and subscripts, respectively. Superscripts are typically used for exponents, while subscripts are used for footnotes or chemical formulas.
				
					<p>x<sup>2</sup> + y<sup>2</sup> = r<sup>2</sup></p>

				
			
6. Inline Code (<code>) and Keyboard Input (<kbd>): <code> is used to display inline code snippets, while <kbd> is used to indicate keyboard input. These elements are often used in technical documentation.
				
					<p>To print a message to the console, use <code>console.log('Hello, World!');</code></p>

				
			
7. Citations (<cite>) and Blockquotes (<blockquote>): <cite> is used to mark the title of a work (e.g., a book or a movie), while <blockquote> is used for longer quotations, typically indented from the surrounding text.
				
					<p><cite>The Great Gatsby</cite> by F. Scott Fitzgerald is a classic novel.</p>
<blockquote>
    <p>This is a longer quotation that requires a blockquote element.</p>
</blockquote>

				
			

Conclusion

These are some of the basic HTML text formatting elements and attributes. CSS (Cascading Style Sheets) can be used to further customize the appearance of text, allowing for precise control over fonts, colors, margins, and more.

Free Worldwide shipping

On all orders above $50

Easy 30 days returns

30 days money back guarantee

International Warranty

Offered in the country of usage

100% Secure Checkout

PayPal / MasterCard / Visa