Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - <div> that breakes text

 
Thread Tools Search this Thread
Old 02-25-2004, 05:12 AM   #1
Default <div> that breakes text



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

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
  Reply With Quote
Old 02-25-2004, 05:19 AM   #2
Mark Parnell
 
Posts: n/a
Default Re: <div> that breakes text

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


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
  Reply With Quote
Old 02-25-2004, 08:03 AM   #3
Jukka K. Korpela
 
Posts: n/a
Default Re: <div> that breakes text

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

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


  Reply With Quote
Old 02-25-2004, 06:22 PM   #4
Rafal 'Raf256' Maj
 
Posts: n/a
Default Re: <div> that breakes text

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 ,"----------"
  Reply With Quote
Old 02-25-2004, 09:06 PM   #5
Jukka K. Korpela
 
Posts: n/a
Default Re: <div> that breakes text

"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


  Reply With Quote
Old 02-25-2004, 09:56 PM   #6
Toby A Inkster
 
Posts: n/a
Default Re: <div> that breakes text

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

  Reply With Quote
Old 02-26-2004, 04:46 AM   #7
Marc Nadeau
 
Posts: n/a
Default Re: <div> that breakes text

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

>
> 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 */
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump