Skip to main content

HTML Line Breaks and Rules

By SamK
0
0 recommends
Topic(s)

In paragraph elements, manually placed Line breaks within the <p> tags are displayed as a single line, no matter how many times they are included.

So, the <br> element in HTML is used to define a line break, which creates a new line without starting a new paragraph.

Example

 <p>This is<br>a paragraph<br>with line breaks.</p> 

Preview:

HTML Line Break Preview

The <hr> tag in HTML defines a horizontal line break and is commonly displayed as a horizontal ruler or line.

It is used to separate content or indicate a change in an HTML page.

Example

<p>This is some text.</p>
<hr>
<p>This is some other text.</p>
<hr>
<p>This is another text.</p>

Preview:

HTML Rule

You can also style the <hr> element by adding a style attribute to the <hr> tag. For example, if you want to give green color to the <hr> element you can use the following code:

<hr style="color:green">

Please check below options for the links to our previous or next tutorial.

Questions & Answers