Skip to content

<br> , <br/>, or <br /> in HTML Horizontal line | difference between <br> and <br/> tag

  • by

The HTML <brtag inserts a single line break. A <brtag is an empty tag which means that it has no end tag like other HTML tags(<p> tag, <div> tag, etc).

HTML <br> Tag :-

  • It inserts a single line break .
  • It is an empty tag without any end tag.
HTML Horizontal line difference between <br> and <br/> tag

Here are few question on br tag can confused you in interview.

Which one use in HTML5: Is it <br>, <br/>, or <br />?

Answers: Simply <br> tag is sufficient to break a line in HTML.

See below example:

<!DOCTYPE html>
<html>
	<body>

		<p>Text for break  <br>HTML Horizontal line</p>

</body>
</html>

Output:

html br tag example

Read more: HTML Line Break br tag complete tutorial

Which is correct, </br> or <br/>?

Answers: Using <br> is just the correct and best way, no need for the forward slash. But <br/> and <br /> is also acceptable. See below code:-

<!DOCTYPE html>
<html>
	<body>

		<p>Text for break  <br/>HTML Horizontal line</p>
		<p>Text for break  </br>HTML Horizontal line</p>

</body>
</html>

What is the difference between <br> and <br/> tag in HTML? Which one should we use?

Answers: The main difference between <br> and <br\> are :

HTML (up to HTML 4): use <br>

HTML 5<br> is preferred, but <br/> and <br /> is also acceptable.

XHTML<br /> is preferred. Can also use <br/> or <br></br>.

<br /> is backwards-compatible with XHTML and well-formed HTML (ie: XHTML) is often easier to validate for errors and debug.

Do comment if you have any doubt and suggestion on this tutorial.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading