What is HTML paragraph?
An HTML paragraph is similar to a paragraph in an article or newspaper. Some texts which can be considered as a paragraph can be given inside <p>tag and its closing </p>
Where to use HTML Paragraph?
- HTML paragraphs can be used wherever a line break is needed after the texts end.
- It can be majorly used whenever some continuous texts which can be shown as small paragraphs.
How to use HTML Paragraph?
- <p> tag is also a block element which automatically gives a line break before and after. So it can be used when the actual need is there.
- Closing tag </p> is necessary even though some browsers work will without this.
- Attributes like bgcolor, width or height cannot be assigned to html paragraph.
- It accepts only align=”left (or) center (or) right (or) justify”, id, class.
Example
<html>
<head>
<title>HTML Paragraph Tutorial</title>
</head>
<body>
<h1>This is the main heading</h1>
<p align=”left”>This is a left aligned paragraph</p>
<p align=”center”>This is a center aligned paragraph</p>
<p align=”right”>This is a right aligned paragraph</p>
<p align=”justify”>This is a justified paragraph. Justified text is text in which all the printed lines in a paragraph (except the final line) are made the same length by the adjustment of spacing between words.</p>
</body>
</html>
<head>
<title>HTML Paragraph Tutorial</title>
</head>
<body>
<h1>This is the main heading</h1>
<p align=”left”>This is a left aligned paragraph</p>
<p align=”center”>This is a center aligned paragraph</p>
<p align=”right”>This is a right aligned paragraph</p>
<p align=”justify”>This is a justified paragraph. Justified text is text in which all the printed lines in a paragraph (except the final line) are made the same length by the adjustment of spacing between words.</p>
</body>
</html>
Next tutorial will be on line breaks and horizontal rule.
Advertisement