Long text in a table does not wrap?

Discussion in 'HTML' started by Simon, Mar 22, 2006.

  1. Simon

    Simon Guest

    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
     
    Simon, Mar 22, 2006
    #1
    1. Advertising

  2. 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
     
    David Dorward, Mar 22, 2006
    #2
    1. Advertising

  3. Simon

    Simon Guest

    >
    >> 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
     
    Simon, Mar 22, 2006
    #3
  4. 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
     
    David Dorward, Mar 22, 2006
    #4
  5. Simon

    dorayme Guest

    In article <>,
    "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.

    >
    > 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
     
    dorayme, Mar 22, 2006
    #5
  6. Simon

    Mark Parnell Guest

    Deciding to do something for the good of humanity, Simon
    <> 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
     
    Mark Parnell, Mar 22, 2006
    #6
  7. Simon

    Simon Guest

    >
    >> >
    >> >> 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
     
    Simon, Mar 23, 2006
    #7
  8. "Simon" <> 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
    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.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Mar 23, 2006
    #8
  9. Simon

    Simon Guest

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

    >
    >> 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
     
    Simon, Mar 23, 2006
    #9
  10. "Simon" <> 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
     
    Jukka K. Korpela, Mar 23, 2006
    #10
  11. Simon

    Simon Guest

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


    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
     
    Simon, Mar 23, 2006
    #11
  12. "Simon" <> wrote in message
    news:...
    > >
    > >> 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.
    > >

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

    --
    Richard
     
    Richard Rundle, Mar 23, 2006
    #12
  13. Simon

    Jim Moe Guest

    Simon wrote:
    >
    > 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.

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
     
    Jim Moe, Mar 23, 2006
    #13
  14. Simon

    Simon Guest

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


    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
     
    Simon, Mar 23, 2006
    #14
  15. "Simon" <> wrote in message
    news:...
    > >> >
    > >>
    > >> 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.
    > >

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

    --
    Richard
     
    Richard Rundle, Mar 23, 2006
    #15
  16. Richard Rundle wrote:

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


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

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

    --
    -bts
    -Warning: I brake for lawn deer
     
    Beauregard T. Shagnasty, Mar 23, 2006
    #16
  17. Simon

    Simon Guest

    Simon, Mar 23, 2006
    #17
  18. "Simon" <> wrote in message
    news:...
    > >> >
    > >>
    > >> 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 ?
    > >

    >
    > http://www.example.com, http://www.example.net and www.example.org are
    > reserved domains
    > see http://www.rfc-editor.org/rfc/rfc2606.txt
    >
    > Simon
    >


    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.

    --
    Richard
     
    Richard Rundle, Mar 23, 2006
    #18
  19. Richard Rundle wrote:

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

    --
    -bts
    -Warning: I brake for lawn deer
     
    Beauregard T. Shagnasty, Mar 23, 2006
    #19
  20. Simon

    Mark Parnell Guest

    Deciding to do something for the good of humanity, Richard Rundle
    <> declared in alt.html:

    > 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

    --
    Mark Parnell

    Now implementing http://blinkynet.net/comp/uip5.html
     
    Mark Parnell, Mar 23, 2006
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott Gordo

    Wrap long URL in table

    Scott Gordo, Sep 21, 2006, in forum: HTML
    Replies:
    10
    Views:
    49,346
    Jukka K. Korpela
    Sep 22, 2006
  2. Aaron Fude

    To wrap or not to wrap?

    Aaron Fude, May 8, 2008, in forum: Java
    Replies:
    12
    Views:
    716
    Chronic Philharmonic
    May 10, 2008
  3. Oliver Graeser
    Replies:
    10
    Views:
    594
    Oliver Graeser
    Sep 26, 2008
  4. Art Werschulz

    Text::Wrap::wrap difference

    Art Werschulz, Sep 22, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    254
    Art Werschulz
    Sep 22, 2003
  5. Art Werschulz

    Text::Wrap::wrap difference

    Art Werschulz, Sep 24, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    257
    Anno Siegel
    Sep 25, 2003
Loading...

Share This Page