Hello.
>My IE6 does not support white-space: pre.
JKKI wonder what you mean by that, especially considering the
JKKfollowing...
JKKDesired as it might be, it's _against_ the specification, since
JKKwhite-space:
JKKpre means honoring both consecutive whitespace (which is what I
JKKmeant by
JKK"support", expecting _that_ to be what you wanted) _and_ line
JKKbreaks so that
JKKno addition line breaks are introduced by a browser.
Try this code:
<span style="font-family: monospace; white-space: pre">hello world</span>
Firefox and Opera show three spaces between words while IE6 shows only one.
>Is it possible to force any browser
to output all spaces as
{white-space: pre} but automatically break long lines into several
lines?
JKKHow would the user then know how many spaces there are?
Visually. If background color of container with text differs from background
color of parent object and fixed-width font is used, it is possible to see
how many spaces there are even if line break occurs. On the other hand, user
can copy text from web-page and paste it somewhere else and he expects that
the text will be the same as he inputed it before. And all spaces should be
kept.
>Such text can be very long and can break the layout of
the page.
JKKIt sounds that you have created yourself a problem by letting users
JKKenter
JKKdata onto your page without adequately preprocessing it. CSS is by
JKKfar a
JKKwrong tool for such issues. Justice will be served, in some sense,
JKKwhen
JKKsomeone submits a gigabyte of junk onto your page.
My site is intended for internal use, therefore all is ok. On some page
users input the regular expressions and these regular expressions are showed
on the same page in a table. Of course, all they are preprocessed before
output, but all spaces should be retained and printed and long lines should
be break into several lines if needed.
I see, <preis not ideal for my task. Because when I copy/paste the text
that includes <precontainer with display: inline, I got newline characters
before and after <precontainer. Therefore, now I try to use <spanfor
that purpose. It looks like this:
<style>
..test {
font-family: 'Courier New', monospace;
font-size: 90%;
color: #000000;
background-color: #80e080;
padding: 0em 0.12em;
}
wbr:after {content: '\ad'}
</style>
<div>The regular expression can be <span
class="test">^hello <wbr> <wbr>world.$</spanor <span
class="test">^goodbye <wbr> <wbr>world.$ </span(two spaces
between words are significant)</div>
All spaces in output string are replaced with " <wbr>". It works in IE
and Firefox, but Opera doesn't support <wbrtag. Specially for Opera used
construction wbr:after {content: '\ad'}, that adds to the end of <wbrtag
the entity. Opera shows as a hyphen at the end of broken line. I
would like that Opera breaks the line without hyphen, but I don't know how
to do that.
--
Best regards, Vadim.