+ 1

how to use line break in document.write

I want to make a new code,so i need help.

2nd Mar 2017, 9:47 AM
M. Farhan Sadique Fareshi
3 Réponses
+ 15
document.write("<br>"); document.close();
2nd Mar 2017, 9:49 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
You need to write the <br> html tag, as you are outputting in an Html source code document... and default behavior of Html is to collapse sequences of whitespaces, and handle new lines charaters as other whitespace. Another way to output breaklines, is to use the <pre> tag behavior: enclosing content will avoid normal behavior, and output source code in it as is, preserving newline characters and without collapsing sequences of whitespaces. This behavior can be reproduce on any Html container, with the 'white-space' Css property ^^
2nd Mar 2017, 12:54 PM
visph
visph - avatar
0
thanks all
3rd Mar 2017, 4:02 PM
M. Farhan Sadique Fareshi