breaking lines with keeping crlf and spaces ?

D

Davor

is it possible with html or css to break text lines inside <td> tag, keeping
crlf-s, spaces and tabs ? Something like line break "stronger" than <pre>
tag ?

thx, Davor
 
N

Neal

is it possible with html or css to break text lines inside <td> tag,
keeping
crlf-s, spaces and tabs ? Something like line break "stronger" than <pre>
tag ?

Sounds like you are describing pre. What does pre not offer you?
 
L

Lunchbox G4

Davor said:
is it possible with html or css to break text lines inside <td> tag, keeping
crlf-s, spaces and tabs ? Something like line break "stronger" than <pre>
tag ?

thx, Davor

Will <br> not work?

//LBG4
 
T

Toby Inkster

Davor said:
is it possible with html or css to break text lines inside <td> tag, keeping
crlf-s, spaces and tabs ?

Sounds like you need:

td {
white-space: pre-wrap;
}

It's part of CSS 2.1, but only supported by Opera 7.5+.

In Opera 4.x-6.x you can use "white-space:pre-wrap" and in Opera 7.0x-7.2x
you can use "white-space:-o-pre-wrap". Mozilla and other Geckos have
"white-space:-moz-pre-wrap".
 
D

Davor

No, I don't prepare text myself, its from MS Access database, and it's
created by different users. Text is edited in textarea box which
automatically breaks lines without crlf-s. I know I could count letters and
insert crlf-s in ASP or Java Script, but I would like to break text lines in
table depending on window size, sizing table columns in percents.

Davor
 
D

Davor

No, it's not like pre. Text is inserted in textarea and saved in database
and it's in one long line whereever the line is broken by textarea
automatically. But I stil want to keep users entered crlf-s and multiple
spaces.

Davor
 
J

Jukka K. Korpela

Because it's so natural and computers do it!
Why do people write the answer before the question?

Davor said:
No, it's not like pre. Text is inserted in textarea and saved in
database and it's in one long line whereever the line is broken by
textarea automatically. But I stil want to keep users entered
crlf-s and multiple spaces.

You should have explained that in the original question. It changes the
whole issue.

In processing user input from textarea, you can't assume much, since
browsers behave in different ways
(see http://www.cs.tut.fi/~jkorpela/forms/textarea.html ).

You _do_ get spaces as entered by the user. What you do then depends on
the context. If the data is echoed to a user in an HTML document, then
the <pre> element takes care of preserving spaces. Replacing spaces by
&nbsp; generally works, though it's really a hack and not guaranteed to
work.

Line breaks are a different beast. You might be unable to distinguish
user-entered line breaks from browser-generated line breaks ("hard
wrapping"), and more seriously you cannot know whether the user
actually _meant_ to break a line but didn't - because he saw the
browser wrap the text and thought that's OK (without realizing that the
line break will probably not be transmitted).

What you really need now is an analysis of what you are doing with the
user data and why.
 
D

Davor

Thanx, that should do the trick... I've tried to break lines on table column
width, but this is even better because now I have wyswyg from user.

Davor
 
D

Davor

Just one more question. Is it possible to get similar behaviour from MS
Access text box, or should I insert crlf-s in VBA ?

Davor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top