KEYPOINTS
- It is used to define a paragraph of text within the structure of an HTML document.
- the <p> element represents the paragraph tag.
- It is a container tag
- Paragraph element is defined by <p> opening tag and </p> closing tag in HTML.
KEYPOINTS
- It is used to define a paragraph of text within the structure of an HTML document.
- the <p> element represents the paragraph tag.
- It is a container tag
- Paragraph element is defined by <p> opening tag and </p> closing tag in HTML.
Syntax:
<p>content</p>
Attributes:
- The
align
attribute in HTML was historically used to set the alignment of various elements, such as paragraphs (<p>
), images, and tables, to the left, center, or right. However, the use of thealign
attribute for styling has been deprecated in favor of CSS, which provides more control and flexibility.
For instance, instead of usingalign="center"
within a paragraph tag:<p style="text-align: center;">This paragraph is centered.</p>
Example:
<!DOCTYPE html>
<html>
<body>
<h2>Welcome To Quipo House</h2>
<!-- Use of <p> tag -->
<p>This is a paragraph.</p>
</body>
</html>
Output:
How to use HTML Horizontal tag in paragraph
Example:
<!DOCTYPE html>
<html>
<body>
<h1>Example of hr</h2>
<h4>This is a heading</h4>
<p>This is a paragraph.</p>
<hr>
<h4>This is a heading</h4>
<p>This is a paragraph</p>
<hr>
</body>
</html>
Output:
How to use HTML Break tag in paragraph
The
<br>
tag in HTML is used to create a line break within text, adding vertical space without starting a new paragraph. It's like hitting the "Enter" key in a word processor, moving the content that follows to a new line while keeping it part of the same block. This tag is especially useful when you want to add a single line break without extra spacing that a new paragraph (<p>
) would introduce. For example, you might use the <br>
tag in an address, a poem, or any place where you need to control the flow of text with precision.The example below shows us how to use <br> tag in breaking lines in paragraphs.
Example:
<!DOCTYPE html>
<html>
<body>
<h1>Example of hr</h2>
<h4>This is a heading</h4>
<p>This is a paragraph <br>with line break</p>
</body>
</html>
Output:
How to use HTML <pre> tag in paragraph
Example:
<!DOCTYPE html>
<html>
<body>
<h1>Example of pre in writing poems</h2>
<pre>
Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky.
</pre>
</body>
</html>
Output: