The <p> tag in HTML is utilized for defining paragraphs within documents. It is crucial to close the <p> tag as it is a paired tag. Failure to close the tag will result in the HTML editor treating each line as a separate paragraph.
Another option is to utilize the align attribute within the paragraph tag. This attribute is responsible for aligning the text content inside a paragraph element.
Understanding the <p> tag can be facilitated through examples. Therefore, we will present a range of different examples for clarity.
Illustration 1: This instance explains the utilization of the <p> tag within an Html file.
<!Doctype Html>
<Html>
<Head>
<Title>
Paragraph Tag
</Title>
</Head>
<Body>
<p>This is a paragraph. Paragraph contains more than one line.Html pargraph tag is used to define the paragraph in the documents. This tag is a pair tag, so it is mandatory to close this tag. </p> If do not close this tag, then the Html editor takes each line in the pargraph.
</Body>
</Html>
The result of the HTML code above can be viewed in the screenshot displayed below:
Illustration 2: In this instance, the align attribute is utilized within the paragraph tag in an HTML document.
<!Doctype Html>
<Html>
<Head>
<Title>
Align attribute in Paragraph Tag
</Title>
</Head>
<Body>
<p align="center">This is a paragraph. Paragraph contains more than one line.<br>Html pargraph tag is used to define the paragraph in the documents.<br> This tag is a pair tag, so it is mandatory to close this tag.</p>
<p align="right">If we do not close this tag, then the Html editor takes each line in the pargraph. </p>
</Body>
</Html>