Html new line character

In HTML, there are several ways to represent a new line character:

  1. BR Tag: The <br> tag is used to insert a line break. It is an empty element, meaning it does not have a closing tag.

Example: <br>

  1. BR Element: The <br> element is similar to the <br> tag, but it is a self-closing element, meaning it does not have a closing tag.

Example: <br />

  1. Line Break: You can also use a line break character (\n) in your HTML code. This is useful when you need to insert a new line in a string of text.

Example: <p>This is a paragraph of text.\nThis is another line of text.</p>

  1. HTML Entity: You can also use an HTML entity (&#13;) to represent a new line character.

Example: <p>This is a paragraph of text.&#13;This is another line of text.</p>

  1. CSS: You can also use CSS to insert a new line character using the white-space property.

Example: <p style="white-space: pre;">This is a paragraph of text.\nThis is another line of text.</p>

Note that the <br> tag and <br /> element are the most commonly used methods to insert a new line character in HTML.