On Mon, Oct 13, 2003 at 09:48:56PM +1000, Wang Feng wrote:
:
: Ok, Now I see what happen (maybe).
:
: So, the "\n" is not for the browser output, but for the *view source*? So,
: it's different from the "echo <br>"?
:
: If so, what's the deal to do that? --- Makes it look nice if the user view
: the source code?
When normally rendering HTML text, multiple continuous whitespace
characters (i.e. "\s+") as a single space. So HTML source code:
----------------------------------------
<p>How are
you?
I am fine.
What else is new?
</p>
----------------------------------------
gets displayed as this:
----------------------------------------
How ar you. I am fine. What else is new?
----------------------------------------
To force a visual linebreak in rendered HTML pages, as you already
discovered you need to manually insert "<br>" tags.
However, if you don't want to litter your HTML source code with a bunch
of gratuitous "<br>" tags all over the place, use the "<pre>" container
tag to make the browser render newlines as visual linebreaks.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php