You can use the <pre>
tag to keep the line breaks.
<pre>
lorem ipsum
lorem ipsum
lorem ipsum
</pre>
The default style for pre
tags is monospaced font, but that can be overriden.
You can achieve the same effect without any extra default formatting using the white-space: pre
CSS property.
<div style="white-space: pre">
lorem ipsum
lorem ipsum
lorem ipsum
</div>
There are several other values for white-space
, but you should refer to the documentation to choose the most fitting one.
Note that pre
will treat every line break the same including the one following the <pre>
or <div>
tags. If you don’t want them you will need to do:
<div style=...>lorem ipsum
lorem ipsum
...