HTML Tutorial


Chapter 3 – HTML Headings and Paragraphs

Welcome back to the third chapter of HTML tutorial. In the previous tutorial, we learnt HTML Elements. In this tutorial, we will discuss about Headings and Paragraphs in HTML.


Headings

Whenever you are creating a webpage, the visible portion which is displayed on the browser window will come from the content which you put inside the <body> tag. Usually we start a page with a title or heading.

In HTML, you can write a title using the heading tag which starts from <h1> and goes up to <h6> tag.

An example HTML code for heading is given below for reference:

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4/h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
    

The output is given below for reference

This is heading 1

This is heading 2

This is heading 3

This is heading 4

This is heading 5
This is heading 6

You can notice that the size of heading keeps reducing from H1 to H6. Here, the heading H1 represents the heading with highest importance, followed by headings with lesser importance in that order. The higher importance headings are displayed in larger fonts compared to those with lesser importance.



Paragraphs

Once you are done with heading, it’s time to add some paragraph text into your HTML page. In HTML, a paragraph is written by enclosing the text within the <p> and </p> tag.

An example of a paragraph in HTML is given below for reference:

<p>
This is a paragraph.
</p>
<p>
This is a second paragraph.
</p>
<p>
This is a third paragraph’s 1st statement.
This is a third paragraph’s 2nd statement.
</p>
        

The output of the above code will be as shown below:

This is a paragraph.

This is a second paragraph.

This is a third paragraph’s 1st statement. This is a third paragraph’s 2nd statement.

If you notice, a paragraph usually starts from a new line.

However if you can notice, the third paragraph where the sentences were present in 2 separate lines in the HTML codes are appearing within the same line in the output. Let us suppose you have a paragraph which you want to write in multiple lines. In such a case you can use line breaks or horizontal line as a line separator.


Hope you liked reading this tutorial, see you in next chapter to explore Line breaks and horizontal line.

Next Chapter Chapter 4 - HTML Line breaks and Horizontal line

Content is copyrighted © www.123mylist.com