<div> that breakes text

Discussion in 'HTML' started by Rafal 'Raf256' Maj, Feb 25, 2004.

  1. Hi, how can I use <div> that will break too long lines as table do, i.e. I
    have realy long text
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

    or i have a <div><pre>... situation, and I want too long lines to be hard-
    broken to fit div width.


    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~l-.~~~~~~~~~~~~~~~~~~~
    GG-1175498 ____| ]____,
    Rafal 'Raf256' Maj X-( * )
    Rafal(at)Raf256(dot)com ,"----------"
    Rafal 'Raf256' Maj, Feb 25, 2004
    #1
    1. Advertising

  2. Rafal 'Raf256' Maj

    Mark Parnell Guest

    On 25 Feb 2004 05:12:35 GMT, "Rafal 'Raf256' Maj" <>
    declared in alt.html:

    > Hi, how can I use <div> that will break too long lines as table do, i.e. I
    > have realy long text
    > aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


    Get your script to insert spaces after every n consecutive non-breaking
    characters.

    A table doesn't wrap long text any more than any other element does.

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    Mark Parnell, Feb 25, 2004
    #2
    1. Advertising

  3. Mark Parnell <> wrote:

    >> Hi, how can I use <div> that will break too long lines as table
    >> do, i.e. I have realy long text
    >> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

    >
    > Get your script to insert spaces after every n consecutive
    > non-breaking characters.


    I guess the question most often arises when someone has souped up a
    guestbook script or found one, then sees what happens when someone
    types a long string without spaces.

    There are usually more serious problems than that, then, and what is
    probably needed is to reconsider what's the big idea in a guestbook
    script (there's actually no serious shortage of virtually empty
    guestbooks on the Web) and then, maybe, finding a _good_ guestbook
    script from a suitable distribution site. The details depend on the
    authoring environment as usual.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Feb 25, 2004
    #3
  4. news:Xns949A666BBF7A2jkorpelacstutfi@193.229.0.31

    >> Get your script to insert spaces after every n consecutive
    >> non-breaking characters.


    > I guess the question most often arises when someone has souped up a
    > guestbook script or found one, then sees what happens when someone
    > types a long string without spaces.


    Som there is no (X)HTML way to make an element that will force braking of
    lines?

    Wouldn't that be a good idea to add element like this into next CSS?



    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~l-.~~~~~~~~~~~~~~~~~~~
    GG-1175498 ____| ]____,
    Rafal 'Raf256' Maj X-( * )
    Rafal(at)Raf256(dot)com ,"----------"
    Rafal 'Raf256' Maj, Feb 25, 2004
    #4
  5. "Rafal 'Raf256' Maj" <> wrote:

    > Som there is no (X)HTML way to make an element that will force
    > braking of lines?


    Surely. <br> (or <br />) to begin with. As we move to _allowed_ line
    breaks, things get rather complicated. So make sure you're solving the
    right problem. Then, re-check that. Are you sure you are doubly sure?
    Click here to continue. Oops, try this:
    http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest

    > Wouldn't that be a good idea to add element like this into next
    > CSS?


    CSS has no elements.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Feb 25, 2004
    #5
  6. Rafal 'Raf256' Maj wrote:

    > Som there is no (X)HTML way to make an element that will force braking of
    > lines?


    Breaking lines partway through a word is generally considered undesirable.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
    Toby A Inkster, Feb 25, 2004
    #6
  7. Rafal 'Raf256' Maj

    Marc Nadeau Guest

    Mark Parnell a écrit:

    > On 25 Feb 2004 05:12:35 GMT, "Rafal 'Raf256' Maj" <>
    > declared in alt.html:
    >
    >> Hi, how can I use <div> that will break too long lines as table do, i.e.
    >> I have realy long text
    >> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

    >
    > Get your script to insert spaces after every n consecutive non-breaking
    > characters.
    >
    > A table doesn't wrap long text any more than any other element does.
    >


    An example of such a PHP function:

    <?php
    /* insert a space (or any $separator ) every $lenght caracter */
    /* only for words longer than $lenght */

    function cutLongWord($string, $lenght, $separator) {
    if ($separator == null) {
    $separator= ' ';
    }
    return preg_replace('/([^ ]{'.$lenght.'})/si','\\1' .$separator , $string);
    }
    ?>

    It's a rough sketch of a function that could be refined but should face most
    situations where you have posters with a broken spacebar.


    Bonne chance!
    --
    mv sco /dev/null
    Marc Nadeau # La Pagerie /* http://www.pagerie.com */
    Marc Nadeau, Feb 26, 2004
    #7
    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. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    724
  2. M Wells
    Replies:
    0
    Views:
    129
    M Wells
    Oct 6, 2004
  3. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    176
    David Dorward
    Jun 1, 2005
  4. mscir
    Replies:
    3
    Views:
    296
    Martin Honnen
    Jun 26, 2005
  5. visu
    Replies:
    4
    Views:
    277
Loading...

Share This Page