Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Long text in a table does not wrap?

Reply
Thread Tools

Long text in a table does not wrap?

 
 
Simon
Guest
Posts: n/a
 
      03-22-2006
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


 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      03-22-2006
Simon wrote:

> 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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
 
 
 
Simon
Guest
Posts: n/a
 
      03-22-2006
>
>> 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.


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


 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      03-22-2006
Simon wrote:

> 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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      03-22-2006
In article <(E-Mail Removed)>,
"Simon" <(E-Mail Removed)> wrote:

> >
> >> 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.

>
> 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


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...

--
dorayme
 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      03-22-2006
Deciding to do something for the good of humanity, Simon
<(E-Mail Removed)> declared in alt.html:

> 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.

--
Mark Parnell

Now implementing http://blinkynet.net/comp/uip5.html
 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      03-23-2006
>
>> >
>> >> 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.

>>
>> 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

>
> 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


 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-23-2006
"Simon" <(E-Mail Removed)> wrote:

> 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
sooooooooooooooooooooooooooooooooooooooooooooooooo oo
appear as
<span title="soooooooooooooooooooooooooooooooooooooooooo ooooooooo">
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.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      03-23-2006
>
>> The problem is many fold.

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


Not true at all.

>
>> First I run a blog host site, so the user can
>> enter what they want,

>
> 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.

>
>> (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).


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.

>
>> Sometimes they enter links that are 200 characters long

>
> 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?

>
>> 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?


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.

>
>> 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.


Your concept of preventing anything that you cannot fix is a much bigger
problem in my opinion.

>
>> 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?


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
> sooooooooooooooooooooooooooooooooooooooooooooooooo oo
> appear as
> <span title="soooooooooooooooooooooooooooooooooooooooooo ooooooooo">
> 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.

>
>> I think that kind of problem should be handled client side.

>
> 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


 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-23-2006
"Simon" <(E-Mail Removed)> wrote:

> 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.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is long long int not as long as promised?? Oliver Graeser C++ 10 09-26-2008 11:41 AM
Having compilation error: no match for call to (const __gnu_cxx::hash<long long int>) (const long long int&) veryhotsausage C++ 1 07-04-2008 05:41 PM
long long and long Mathieu Dutour C Programming 4 07-24-2007 11:15 AM
unsigned long long int to long double Daniel Rudy C Programming 5 09-20-2005 02:37 AM
Assigning unsigned long to unsigned long long George Marsaglia C Programming 1 07-08-2003 05:16 PM



Advertisments