html new line in paragraph code example

Example 1: new line html

<!-- Code by Scratchy -->
<!-- Twitter: @S_cratchy-->

Line 1 of text
<br>
Line 2 of text

Example 2: how to make new line in html paragraph

<p>
Will Mateson<br />
Box 61<br />
Cleveland, Ohio<br />
</p>

Example 3: html text content new line

//setting this css style solving problem with new line in textContent
h1.setAttribute('style', 'white-space: pre;');

//add \r\n in text everywhere You want for line-break (new line)
h1.textContent = "this is line one  \r\n and this is line 2";

Example 4: html newline

1st line
<br>
2nd line

Tags:

Html Example