Html new line tag
In HTML, there are several ways to create a new line:
- BR Tag: The
<br>
tag is used to insert a line break, which means a new line will be created. It is often used to separate paragraphs or to create a new line within a paragraph.
Example:
This is a paragraph of text.<br>
This is another paragraph of text.
- P Tag: The
<p>
tag is used to define a paragraph of text. It automatically creates a new line before and after the text.
Example:
<p>This is a paragraph of text.</p>
<p>This is another paragraph of text.</p>
- Line Break: You can also use a line break by simply pressing the Enter key twice in the HTML code. This will create a new line.
Example:
This is a paragraph of text.
This is another paragraph of text.
- Pre Tag: The
<pre>
tag is used to define preformatted text. It preserves the formatting of the text, including line breaks.
Example:
<pre>This is a paragraph of text.
This is another paragraph of text.</pre>
- NL Tag: The
or
entities can be used to create a new line. These entities represent a line feed (LF) or a carriage return (CR) character, respectively.
Example:
This is a paragraph of text.
This is another paragraph of text.
Note that the BR
tag is the most commonly used method to create a new line in HTML.