PDA

View Full Version : Spaces in html, displayed in the browser



Roelf
Feb 19th, 2003, 09:36 AM
Hi, can anyone help me with this:
In a website, someone enters a lot of tekst, this is displayed in another html-page. Sometimes he wants to separate text with more than one space. The browser removes all the extra spaces, and just displays them as one space. Now i tried to replace them (scriptwise) with a   that part works, but the sentences are no longer wrapped within the display area (duh, it is a nonbreaking space). Is there another sign, like   which is displayed by the browser as a whitespace, but doesn't prevent the browser from wrapping the text?

Thanks,
Roelf

meow
Feb 19th, 2003, 09:44 AM
If you wan 2 spaces replace with *space*  i.e. mix keyboard spaces and the non-breaking space entity.

cg9com
Feb 19th, 2003, 04:55 PM
you can use the <pre></pre> to preserve white space.
or a css feature like.

.mypre {
white-space:pre;
}

<div class="mypre">
spaces are preserved now!
</div>