Force long line wrapping at some character

G

Gnarlodious

Is there a way using CSS to force Firefox to wrap window-stretching lines? I
want to avoid horizontal scrolling but a script returns a long line:
"blue/red/green/blue/yellow/magenta/cyan/gray/black/orange/dark
green/teal/tan/brown/violet/gold/dark blue/pink/lavender/".

IE wraps the line at the slash character as if it were a space, can I force
Firefox to do it too?

-- Gnarlie
 
D

David Dorward

Gnarlodious said:
Is there a way using CSS to force Firefox to wrap window-stretching lines?
No.

I want to avoid horizontal scrolling but a script returns a long line:
"blue/red/green/blue/yellow/magenta/cyan/gray/black/orange/dark
green/teal/tan/brown/violet/gold/dark blue/pink/lavender/".

Rewrite the script so it places a space before and after each slash.
 
J

Jukka K. Korpela

Gnarlodious said:
Is there a way using CSS to force
No.

I want to avoid horizontal scrolling but a script returns a long
line: "blue/red/green/blue/yellow/magenta/cyan/gray/black/orange/dark
green/teal/tan/brown/violet/gold/dark blue/pink/lavender/".

Fix the script. Why would you emit such a string?

The slash is an ambiguous character and should seldom be used in normal
text.
IE wraps the line at the slash character as if it were a space,

If you really, really need to use (and I mean _really_) a long string with
no whitespace, inserting <wbr> at suitable places (to allow a line break)
is the practical solution. More on this and related stuff:
http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest
 
B

Bernhard Sturm

Gnarlodious said:
Is there a way using CSS to force Firefox to wrap window-stretching lines? I
want to avoid horizontal scrolling but a script returns a long line:
"blue/red/green/blue/yellow/magenta/cyan/gray/black/orange/dark
green/teal/tan/brown/violet/gold/dark blue/pink/lavender/".

not really... there is a css attribute called word-break, but this is IE
proprietary only, and you should avoid it.
If you want to know more about word-breaking issues, see:
http://www.cs.tut.fi/~jkorpela/html/nobr.html
IE wraps the line at the slash character as if it were a space, can I force
Firefox to do it too?

you could define overflow:hidden; then it doesn't break up your design,
however, for obvious reason this is not the best solution. You could
also force your text to wrap with the PHP wordwrap(); function
(http://ch2.php.net/wordwrap), but this requires that your text is
either dynamically generated, or you have to parse your pages through a
PHP parser.

HTH
bernhard
 
B

Bernhard Sturm

Gnarlodious said:
Is there a way using CSS to force Firefox to wrap window-stretching lines? I
want to avoid horizontal scrolling but a script returns a long line:
"blue/red/green/blue/yellow/magenta/cyan/gray/black/orange/dark
green/teal/tan/brown/violet/gold/dark blue/pink/lavender/".

not really... there is a css attribute called word-break, but this is IE
proprietary only, and you should avoid it.
If you want to know more about word-breaking issues, see:
http://www.cs.tut.fi/~jkorpela/html/nobr.html
IE wraps the line at the slash character as if it were a space, can I force
Firefox to do it too?

you could define overflow:hidden; then it doesn't break up your design,
however, for obvious reason this is not the best solution. You could
also force your text to wrap with the PHP wordwrap(); function
(http://ch2.php.net/wordwrap), but this requires that your text is
either dynamically generated, or you have to parse your pages through a
PHP parser.

HTH
bernhard
 
B

Bernhard Sturm

Gnarlodious said:
Is there a way using CSS to force Firefox to wrap window-stretching lines? I
want to avoid horizontal scrolling but a script returns a long line:
"blue/red/green/blue/yellow/magenta/cyan/gray/black/orange/dark
green/teal/tan/brown/violet/gold/dark blue/pink/lavender/".

not really... there is a css attribute called word-break, but this is IE
proprietary only, and you should avoid it.
If you want to know more about word-breaking issues, see:
http://www.cs.tut.fi/~jkorpela/html/nobr.html
IE wraps the line at the slash character as if it were a space, can I force
Firefox to do it too?

you could define overflow:hidden; then it doesn't break up your design,
however, for obvious reason this is not the best solution. You could
also force your text to wrap with the PHP wordwrap(); function
(http://ch2.php.net/wordwrap), but this requires that your text is
either dynamically generated, or you have to parse your pages through a
PHP parser.

HTH
bernhard
 
B

Bernhard Sturm

Bernhard Sturm wrote:
.... yes and his newsreader wrote it 3 times... sorry for that going to
sleep now.
 
B

Bernhard Sturm

Bernhard Sturm wrote:
.... yes and his newsreader wrote it 3 times... sorry for that, going to
sleep now.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top