Long text in a table does not wrap?

S

Simon

Hi,



I have a <table style="width:100%"> but when the text is very long, (with no
space), it does not wrap under firefox 1.5, it actually adds a scroll bar.



What other style must I use to make sure that it is not wider that 100%.



Many thanks.



Simon
 
D

David Dorward

Simon said:
I have a <table style="width:100%"> but when the text is very long, (with
no space), it does not wrap under firefox 1.5, it actually adds a scroll
bar.

Correct. It is called WORD wrap, it wraps on work breaks. You need to add
word breaks for it to wrap at.
 
S

Simon

Correct. It is called WORD wrap, it wraps on work breaks. You need to add
word breaks for it to wrap at.

Thnaks for pointing out the WORD wrap, I almost didn't see WORD wrap there.

But, I find it hard to believe that there isn't something to go around only
WORD wraps.
Isn't there a css of some sort to enforce the given width of the table even
if the WORD is wider than the table?

Simon
 
D

David Dorward

Simon said:
But, I find it hard to believe that there isn't something to go around
only WORD wraps.
Isn't there a css of some sort to enforce the given width of the table
even if the WORD is wider than the table?

Last time I checked, overflow didn't have much effect on tables. I suppose
it might be different with a fixed layout, or collapsed border table.
 
D

dorayme

Correct. It is called WORD wrap, it wraps on work breaks. You need to add
word breaks for it to wrap at.

Thnaks for pointing out the WORD wrap, I almost didn't see WORD wrap there.

But, I find it hard to believe that there isn't something to go around only
WORD wraps.
Isn't there a css of some sort to enforce the given width of the table even
if the WORD is wider than the table?

Simon[/QUOTE]

What do you want to do, let's have a look at the actual long
word(s). There may be ways to solve the prob depending on the
details.

There was a discussion about some gene sequencing text and how
best to represent it in html and css a while back, I forget if it
bore directly on your prob...
 
M

Mark Parnell

Deciding to do something for the good of humanity, Simon
Isn't there a css of some sort to enforce the given width of the table even
if the WORD is wider than the table?

That sounds like an awfully long word.

Get your server-side script to insert a hyphen every n characters. Of
course, to make it short enough to fit on a small screen, it's going to
look really short on a larger screen, but there's not much you can do
about that.
 
S

Simon

What do you want to do, let's have a look at the actual long
word(s). There may be ways to solve the prob depending on the
details.

There was a discussion about some gene sequencing text and how
best to represent it in html and css a while back, I forget if it
bore directly on your prob...

The problem is many fold. First I run a blog host site, so the user can
enter what they want, (and I don't want to stop them).
Sometimes they enter links that are 200 characters long or things like "I am
soooooooooo.[x200chars]..ooo bored"

Then on the homepage I display the last 25 messages, (the first 45 words or
250 chars). And sometime on of those long words will break the display.
Luckily the site is busy enough for the messages to move along fine and the
display is only broken once in a while.

In fact at the moment it is fine, and I was a bit lucky to notice the
problem.

That is why I wanted to break the long words.
I could check every entry for words that are more than 'xx' chars in a row
but I was hopping to find a simpler way, (seen that it only happens once in
a while I don't know if I want my servers to check every entry). I think
that kind of problem should be handled client side.

Simon
 
J

Jukka K. Korpela

Simon said:
The problem is many fold.

Indeed, and the problem you described isn't your real problem.
First I run a blog host site, so the user can
enter what they want,

Don't let them do that.
(and I don't want to stop them).

Then accept the consequences (including spam that will be sent - I find it
odd that you take destructive measures - fake address in From field - against
suspected E-mail spam, which can be handled rather well these days, but don't
worry the least about blog spam).
Sometimes they enter links that are 200 characters long

You are not inserting the URLs as text, are you? Decent blog software should
be able to let users enter real links, with link texts and URLs as separate
things and with URLs used in the internal code (HTML source) only.
or things like "I
am soooooooooo.[x200chars]..ooo bored"

Prevent it or accept the consequences.
Then on the homepage I display the last 25 messages, (the first 45 words
or 250 chars).

So you truncate messages but not words. What's the point?
In fact at the moment it is fine, and I was a bit lucky to notice the
problem.

This sounds like the explanation to what the common saying "No problem"
really means (in some cultures at least): there is a problem, but it has not
exploded yet.
That is why I wanted to break the long words.

Huh? So why don't you do that? Why would you try to leave it to browsers,
which have even less an idea of what is going on?
I could check every entry for words that are more than 'xx' chars in a
row but I was hopping to find a simpler way,

Surely. Check for the lengths of "words", with "word" defined as a maximal
sequence of non-whitespace characters, and truncate a "word" longer than a
reasonable limit, preferably indicating the truncation and making the
unabridged version available somehow, e.g. making
sooooooooooooooooooooooooooooooooooooooooooooooooooo
appear as
<span title="sooooooooooooooooooooooooooooooooooooooooooooooooooo">
soooo<span class="trunc">[…]</span>ooo</span>
with some suitable styling like
..trunc { color: #555; background: white; }
to indicate that the notation is not part of actual user input.

The reasonable limit depends on the language, of course.
I think that kind of problem should be handled client side.

You are very wrong here.
 
S

Simon

Indeed, and the problem you described isn't your real problem.

Not true at all.
Don't let them do that.

Yes I will, this is the service I offer and this is the service they will
get.
My job is to bend over backward for the users rather than preventing them
from doing something because I don't have the right skills.
Then accept the consequences (including spam that will be sent - I find it
odd that you take destructive measures - fake address in From field -
against
suspected E-mail spam, which can be handled rather well these days, but
don't
worry the least about blog spam).

No, I have many filters to prevent spam, no code is executed on the server.
No script is executed on the client machine, (no JavaScript is allowed).

I am not going to stop them from outputting something on the screen because
you don't know how to control malicious code.
You are not inserting the URLs as text, are you?

No, they are. It is one of their option of they want.
Decent blog software should be able to let users enter real links, with
link texts and URLs as separate
things and with URLs used in the internal code (HTML source) only.

No, again you are confusing what you want to see happening and what the user
wants.
If they want to output a link that is +200 chars long then I will oblige.
or things like "I
am soooooooooo.[x200chars]..ooo bored"

Prevent it or accept the consequences.

See above, they can enter what they wish.
What would, (could?), be the consequences of a 200 chars word?
So you truncate messages but not words. What's the point?

Just to display on the home page. I am not truncating any of their message.
I am just finding a practical way of displaying the last 25 messages.
This sounds like the explanation to what the common saying "No problem"
really means (in some cultures at least): there is a problem, but it has
not
exploded yet.

Your concept of preventing anything that you cannot fix is a much bigger
problem in my opinion.
Huh? So why don't you do that? Why would you try to leave it to browsers,
which have even less an idea of what is going on?

What does that mean?
Why don't I do what? Break long words? Yes, I can do it, but to what length?
10 chars, 20chars or 100 chars for big screens?
I could check every entry for words that are more than 'xx' chars in a
row but I was hopping to find a simpler way,

Surely. Check for the lengths of "words", with "word" defined as a maximal
sequence of non-whitespace characters, and truncate a "word" longer than a
reasonable limit, preferably indicating the truncation and making the
unabridged version available somehow, e.g. making
sooooooooooooooooooooooooooooooooooooooooooooooooooo
appear as
<span title="sooooooooooooooooooooooooooooooooooooooooooooooooooo">
soooo<span class="trunc">[…]</span>ooo</span>
with some suitable styling like
.trunc { color: #555; background: white; }
to indicate that the notation is not part of actual user input.

Yes that is one possibility of course. It does look elegant as well.
The reasonable limit depends on the language, of course.

It is only for display on the home page, I am not truncating their real
entries.
You are very wrong here.

No, if they have a very wide screen then 'xxx' chars can be shown.
If they have a tiny screen then only 'xx' chars can be seen.

Simon
 
J

Jukka K. Korpela

Simon said:
I am not going to stop them from outputting something on the screen
because you don't know how to control malicious code.

I have no idea of what you are babbling about. I notice that you keep using a
forged From field. Please do not stop doing so before you have a clue.
 
S

Simon

I have no idea of what you are babbling about. I notice that you keep
using a
forged From field. Please do not stop doing so before you have a clue.

And I see that you carefully ignored all my replies, thanks.

So now you choose to move on my "from field". Why? Do you want to send me an
email?
How many people do you know that don't change the from field to prevent
spam?

Simon
 
R

Richard Rundle

Simon said:
And I see that you carefully ignored all my replies, thanks.

So now you choose to move on my "from field". Why? Do you want to send me an
email?
How many people do you know that don't change the from field to prevent
spam?

Around here, I would say most of the regulars have valid from fields.
 
J

Jim Moe

Simon said:
The problem is many fold. First I run a blog host site, so the user can
enter what they want, (and I don't want to stop them).
Sometimes they enter links that are 200 characters long or things like "I am
soooooooooo.[x200chars]..ooo bored"
For each of the message's <p> elements apply the style
"overflow:hidden", at least for the main page listing. This is easily
accomplished with CSS.
The other suggestions require that you scan and modify each message.
 
S

Simon

Around here, I would say most of the regulars have valid from fields.

I see that now, but it is a common practice to use example.com
I also don't get, "I notice that you keep using a forged From field. Please
do not stop doing so before you have a clue."

What is that supposed to mean?

Simon
 
R

Richard Rundle

Simon said:
I see that now, but it is a common practice to use example.com


It's not as far as I'm aware. Would YOU like it if you were the domain owner
of example.com and had to filter out everyone else's spam ?
 
B

Beauregard T. Shagnasty

Richard said:
It's not as far as I'm aware. Would YOU like it if you were the domain owner
of example.com and had to filter out everyone else's spam ?

Please go to: http://example.com/

No real person uses that domain (com/net/org), it is reserved for things
just like this.
 
R

Richard Rundle

Simon said:

OK, I knew about .invalid as a reserved TLD for making it obvious that it
was not a real domain, but not example.com etc. (To nitpick, it's
example.com that's a reserved domain, not http://www.example.com, as per
Beauregard's response). Apologies for my error.

Still there is (I believe) a RFC that specifies valid live email addresses
for the From: field, although I don't know which one it is at the moment.
 
B

Beauregard T. Shagnasty

Richard said:
(To nitpick, it's example.com that's a reserved domain, not
http://www.example.com, as per Beauregard's response).

It is example.com (or .net or .org) that is the reserved domain name. I
gave you a clickable link to it so you could see for yourself.
 
M

Mark Parnell

Deciding to do something for the good of humanity, Richard Rundle
Still there is (I believe) a RFC that specifies valid live email addresses
for the From: field, although I don't know which one it is at the moment.

RFC 1036.
"The "From" line contains the electronic mailing address of the person
who sent the message"
http://www.faqs.org/rfcs/rfc1036.html
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top