Headings and Paragraphs in HTML

Hi guys how are you, I hope you are all fine today, I will tell you about heading and paragraphs.

Headings

Headings are used to describe the contents below them, it can be a single word or a phrase. In HTML there are six types of headings that are used for various sizes of text.

  1. <h1> heading one </h1>
  2. <h2> heading two </h2>
  3. <h3> heading three </h3>
  4. <h4> heading four <h4>
  5. <h5> heading five </h5>
  6. <h6> heading six </h6>
Note 
  • Every tag you open must be closed where its effect ends.

  • A <h4> by default has the same text size as a normal paragraph <p>.

Code for headings

  1. <!DOCTYPE html>  
  2. <html>  
  3. <head lang="en">  
  4.     <meta charset="UTF-8">  
  5.     <title>Headings</title>  
  6. </head>  
  7.   
  8.    <body>  
  9.       <h1> Salman Aslam Author at C# Corner  </h1>  
  10.       <h2> Salman Aslam Author at C# Corner  </h2>  
  11.       <h3> Salman Aslam Author at C# Corner  </h3>  
  12.       <h4> Salman Aslam Author at C# Corner  </h4>  
  13.       <h5> Salman Aslam Author at C# Corner  </h5>  
  14.       <h6> Salman Aslam Author at C# Corner  </h6>  
  15.   
  16.    </body>  
  17. </html>  
Output

Output


Paragraphs

Paragraph are used if you want to finish what you are talking about and start a new conversation. 
  • If you want to explain something in your web you use a paragraph.

  • For a paragraph we use a <p> tag.

  • Use a <p> followed by what you want for your paragraph followed by a </p>

    For example

    1. <p> This is simple paragraph </p>   
Code for Paragraph
  1. <!DOCTYPE html>  
  2. <html>  
  3. <head lang="en">  
  4.     <meta charset="UTF-8">  
  5.     <title>Paragraphs</title>  
  6. </head>  
  7. <body>  
  8.   
  9.     <h3> About C# Corner: </h3>  
  10.     <p> A place for coders, where you can find programming related stuff</p>  
  11.     <h3> About Salman Aslam:</h3>  
  12.     <p>I'm doing BSCS from University of Gujrat Pakistan. I 'm   entrepreneur and     FreeLancer. <br>  
  13.         I'm web designer and developer and running a software house "M      Technologies Pak " (https://www.facebook.com/MTechnologiesPak).<br>  
  14.         My skills are C# ,HTML,CSS,Javascript,Bootstrap,PHP</p>  
  15.   
  16. </body>  
  17. </html>  
Output

program output

Note: <h1> to <h6> and <p> add by default one line break. And <br> is used for a line break.

That's it for today, go and add headings and paragraphs to your webpage, if you have any problem please comment below. Stay connected to C# Corner and wait for my next article on text formatting in HTML.

Up Next
    Ebook Download
    View all
    Learn
    View all