output:

hello
How are you

code:

<p>hello <br> How are you </p>

How to achieve same output without <br>?

26 s
26

You can use white-space: pre; to make elements act like <pre>, which preserves newlines. Example:

p {
  white-space: pre;
}
<p>hello 
How are you</p>

Note for IE that this only works in IE8+.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *