Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   <div> that breakes text (http://www.velocityreviews.com/forums/t157296-div-that-breakes-text.html)

Rafal 'Raf256' Maj 02-25-2004 05:12 AM

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

Mark Parnell 02-25-2004 05:19 AM

Re: <div> that breakes text
 
On 25 Feb 2004 05:12:35 GMT, "Rafal 'Raf256' Maj" <spam@raf256.com>
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

Jukka K. Korpela 02-25-2004 08:03 AM

Re: <div> that breakes text
 
Mark Parnell <webmaster@clarkecomputers.com.au> 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



Rafal 'Raf256' Maj 02-25-2004 06:22 PM

Re: <div> that breakes text
 
jkorpela@cs.tut.fi 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 ,"----------"

Jukka K. Korpela 02-25-2004 09:06 PM

Re: <div> that breakes text
 
"Rafal 'Raf256' Maj" <spam@raf256.com> 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



Toby A Inkster 02-25-2004 09:56 PM

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


Marc Nadeau 02-26-2004 04:46 AM

Re: <div> that breakes text
 
Mark Parnell a écrit:

> On 25 Feb 2004 05:12:35 GMT, "Rafal 'Raf256' Maj" <spam@raf256.com>
> 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 */


All times are GMT. The time now is 07:27 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.