Headings and Paragraph in HTML with Examples

0
277

In the last couple of tutorials we learned about the basic structure of an HTML document and about bold , italic , underline texts. In this tutorial we will learn about headings and paragraph in HTML. So let’s start.

Paragraph in HTML

You probably have seen the newspaper in which everything is written in a good way so that people can read everything easily. Same as that when we write something on web page we write it in a way people can read it easily. For this purpose we use paragraph tag ( <p> </p> ). Think about this paragraph ( paragraph you are reading ) and above paragraph. Both are written using <p> tag. Remember that from now everything we will write would be inside the body tag. So paragraph should be inside the body tags.

Syntax of writing paragraph tag

<p> Text which you want to display </p>

See the above tags ( opening and closing paragraph tags ) these are used to write a paragraph on a web page. All the text you want to write in a paragraph is always inside opening and closing tags.

Example of Paragraph in HTML

Paragraph Example Code

Paragraphs in HTML

Output

More than one paragraph example

Paragraph Example in HTML

Output

Paragraphs in HTML with example

 

Now you have the clear understanding of HTML paragraph tag. Every time we have to write something on the web page even if it’s not a complete line we will use paragraph tag.

Headings in HTML

As you can see we have written some paragraphs in the web page. You may have seen web pages where we have something bigger than the normal text to display as the heading of the paragraph. There are six heading used in HTML that are from heading one to heading six. Heading one is the largest heading and heading six is the smallest heading. See the example below.

Syntax of Headings in HTML

<h1>   Text to display as heading  1 </h1>

<h2>   Text to display as heading  2 </h2>

<h3>   Text to display as heading  3 </h3>

<h4>   Text to display as heading  4 </h4>

<h5>   Text to display as heading  5 </h5>

<h6>   Text to display as heading  6 </h6>

Example code

HTML Headings with example

Output in the browser

Examples of heading in HTML

Where we can use headings ?

So let’s say you have to explain 2 sports games on a web page. You will use the heading tags to display the name of the game. See example below.

Use of Headings with paragraph

Output

Heading with paragraphs

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here