i'm writing this:
echo "foo";
echo "\n";
echo "bar";
and "bar" is not written in the line below.
What am i doing wrong?
Javi
i'm writing this:
echo "foo";
echo "\n";
echo "bar";
and "bar" is not written in the line below.
What am i doing wrong?
Javi
It will be written on a new line if you examine the source code of the page. If you want it to appear on a new line when it is rendered in the browser, you'll have use a
<br />
tag instead.the html element break line depend of it's
white-space
style property. in the most of the elements the defaultwhite-space
isauto
, which mean break line when the text come to the width of the element. if you want the text break by\n
you have to give to the parent element the style:white space: pre-line
, which will read the\n
and break the line, orwhite-space: pre
which will also read\t
etc. note: to write\n
as break-line and not as a string , you have to use a double quoted string ("\n"
) if you not wanna use a white space, you always welcome to use the HTML Element for break line, which is<br/>