Formatting Text in html
Home Courses Community Support
Formatting Text in html

Text formatting is most important to you if you need to work on text oriented website, like blogs, forums etc. Apart from this, well formatted text provide a beautiful look to webpage. So the type of website does not matter enough. We should always take care how we are delivering our content to user.


First thing to learn in text formatting is headings. If we need to display large size text then we use headings. HTML have six types in headings i.e. H1, H2, H3, H4, H5 and H6.

Size of headings decrease from H1 to H6. H1 is largest in size and generally used for Page title at top of the page. H2 is used for paragraph, title etc, even here is not any standard to tell which heading need to be used. You can use any heading as per your requirement.

See below code to know how to use heading-

<!DOCTYPE html>
<head><title>Text Formatting</title></head>
<h1>This is first heading, H1.</h1>
<h2>This is second heading, H2.</h2>
<h3>This is third heading,H3.</h3>
<h4>This is fourth heading, H4.</h4>
<h5>This is fifth heading, H5.</h5>
<h6>This is sisth heading, H6.</h6>


Above code will print the text as below image

Apart from headings HTML have many more tags for text formatting to set the format of our web text& i.e.& bold <b>, italic <i>, underline <u>, delete<del>, emphasize<em>, small<small>, superscript<sup>, subscript<sub>, insert<ins>, mark<mark> and strong<strong>.

See below code-

<!DOCTYPE html>
<head><title>Text Formatting</title></head>
<h1>Text Formatting</h1>
<b>This is bold text.</b>
<br><i>This is italic text.</i>
<br><u>This is underline text.</u>
<br><del>This is deleted text.</del>
<br>This is <em>EMPHASIZE</em> text.
<br>This is <small>small</small> text.
<br>This is <sup>superscripted</sup> text.
<br>This is <sub>subscripted</sub> text.
<br>This is <ins>inserted</ins> text.
<br>This is <mark>marked</mark> text.
<br>This is <strong>strong</strong> text.

Above code will print the text as given in below images-

enlightened<BR> Tag: In above code we have used <BR> tag. This tag is used to break the line. It means if you use <br> tag then the text will start from new line.



← Preview

Using Attributes in HTML Element

Next →

Adding an Image


Our mission is to provide highly effective and quality education via innovative solutions. Geeksdemy look forward to bridge the gap between in-demand technology and academics in order to deliver innovative, easy, interesting and affordable learning across the Globe.


  • Python
  • Game Development with Unity 3D
  • Arduino
  • PCB & Circuit Designing
  • Robotics and Embedded C
  • 8051/8052 Embedded Systems
  • QuadCopter & UAV
  • MATLAB with Robotics
  • Raspberry Pi
Learn On the Go!
Get the Android App
Get the iOS App