EN
HTML - how to display newline characters located in the text in the source code?
1 answers
6 points
Is it posiible to display newline characters, in text on my webpage, that are located in my HTML source code?
My source code:
Currently, my webpage displays the text:
I want to get:
1 answer
1 points
In HTML you can use <br />
elements.
xxxxxxxxxx
1
<article class="message">
2
<div class="item">
3
<header></header>
4
<div class="text">1<br />2<br />3<br />4<br />5<br />6</div>
5
</div>
6
</article>
In CSS, you can use one of the:
white-space: pre;
white-space: pre-line;
white-space: pre-wrap;
Example:
xxxxxxxxxx
1
<article class="message">
2
<div class="item">
3
<header></header>
4
<div class="text" style="white-space: pre-line">1
5
2
6
3
7
4
8
5
9
6</div>
10
</div>
11
</article>
0 commentsShow commentsAdd comment