HTML | Paragraph

0
38
HTML Paragraph

HTML Paragraph –

  • HTML paragraph or HTML <p> tag is used to describe a paragraph. <p> tag contains opening tag as well as closing tag. any text is written between <p> and </p> tag. <p> tag works as indicator of starting of new paragraph. if paragraph closing tag is not used then, it may produce unexpected outputs. we will see through an example how it works.

Syntax : 

 <p> This is Paragraph Tag </p>

For Example – 

<!DOCTYPE html> 
<html> 
<head> 
	<title> Paragraph Tag </title> 
</head> 
<body> 
	<p> This is First     Paragraph </p> 
	<p> This is second Paragraph </p> 
</body> 
</html> 

Output Here : 

 This is First Paragraph
 This is second Paragraph

Space Inside Paragraph Tag – 

We can see in the example that there is some spaces given before and after paragraph. hrml language produces space by default. <p> tag will add space before and after a paragraph. in the case, when we need to use multiple spaces then, browser automatically removes spaces and keep only one space.

<!DOCTYPE html> 
<html> 
<head> 
	<title> Space in Paragraph</title> 
</head> 
<body> 
	<p> 
	This artical contains multiple 
	lines. But HTML lang removes them 
	to a single line. 
	</p> 
	
	<p> 
	This artical 	 has multiple 
	spaces.	 But HTML removes them 
	all to a	 single space. 
	</p> 
</body> 
</html>

Output Here : 

This artical contains multiple lines. But HTML lang removes them to a single line.
This artical has multiple spaces. But HTML removes them all to a single space

<br> Break Tag – 

  • this tag is used when we need to change the line of a content. <br> tag doesm’t contain closing tag.
<!DOCTYPE html> 
<html> 
<head> 
	<title> Break Tag </title> 
</head> 
<body> 
	<p> 
	This artical contains multiple <br>
	lines. But HTML lang removes them <br>
	to a single line. 
	</p> 
</body> 
</html>

Output Here : 

This artical contains multiple 
lines. But HTML lang removes them
to a single line.

<hr> horizontal line Tag – 

  • this tag is used when we need to make a line. <hr> tag doesn’t contain closing tag.
<!DOCTYPE html> 
<html> 
<head> 
	<title> Horizontal Tag </title> 
</head> 
<body> 
	<p> 
	This artical contains multiple lines <hr>
        horizontal line
	</p> 
</body> 
</html>

Output Here : 

This artical contains multiple lines

horizontal line

Follow Facebook Page

LEAVE A REPLY

Please enter your comment!
Please enter your name here