HTML
HTML Paragraphs
HTML paragraphs are applied to add text to a document in a way that automatically adjusts the line endings to fit the browser window size.
Each line of text extends the whole length of the window. The <p> tag defines a paragraph. The use of </p> is optional.
HTML automatically adds blank lines before and after a paragraph.
<!DOCTYPE html>
<html>
<body>
<p>HTML Paragraphs</p>
</body>
</html>
Attributes
Some significant attributes of paragraph tags are as follows:
Align: It indicates the arrangement of paragraphs. The possible values are left, right, and center. The default value is left.
<!DOCTYPE html>
<html>
<body>
<p align="center">HTML Paragraphs</p>
</body>
</html>
The above code displays text one in the center of the page.
Horizontal Line
The <hr> tag in HTML stands for “Horizontal Rule”. It is a self-closing tag used to create a horizontal line or rule to separate content within a web page. We use it to divide sections of web pages or indicate a thematic break between content sections.
Here is a basic example of <hr> tag:
<!DOCTYPE html>
<html>
<body>
<p>Horizontal line.</p>
<hr>
<p>Horizontal line example</p>
</body>
</html>
In the above example, the <hr> tag creates a horizontal line between the two paragraphs.
The horizontal rule can be customized using CSS to modify color, width, height, and style.
Line Break
The <br> tag in HTML stands for “line break”. Users use it to insert a line break, or in other words, to create a new line within the text. The <br> tag doesn’t have a closing tag.
Here’s a basic example of the <br> tag:
<!DOCTYPE html>
<html>
<body>
<p>Here is the example of line break.
<br>
This text is on a new line.</p>
</body>
</html>
In the above example, the <br> tag inserts a line break between the two paragraphs, causing the second paragraph to start on a new line.
The <br> tag is commonly used when you want to break lines within a paragraph, such as in addresses or poems, or to add extra space between lines of text.