0
How do you do a line break in java, I have a run-on sentence?
I'm a c++ programer messing with js, and iv have tried \n and it dont break the two sentences up, what I want is: -Math problem1 -Math problem2 https://code.sololearn.com/Wp6uhcK5rY5N/?ref=app
4 Respuestas
+ 2
When you write to the page, you're not writing JavaScript; you're writing HTML. \n is a special "line feed" character that doesn't create a line break in the browser's rendering of the HTML. It WILL create a line break in the HTML file itself, but the browser doesn't take this into consideration when it renders out the markup.
Thus, the br tag is required.
Disclaimer:- I searched stackoverflow and found out why '\n' doesn't works? The question is answered by BraedenP
+ 18
"\n"
//works in java
+ 5
or use "<br>";
0
thanks guys Idk why \n wasnt working but <br> solved it