+ 1
how to use line break in document.write
I want to make a new code,so i need help.
3 Answers
+ 15
document.write("<br>");
document.close();
+ 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 ^^
0
thanks all