Text wrapping problem

Post April 17th, 2006, 9:14 am

Quickie

I have a table that is 160 pixels wide
I have a link (unbroken text), that is 50 characters long

How do I tell HTML to wrap it around, rather than expanding the table width?

Exaple:
ForexampleifIhavereallylongtextitwillexpandthesizeofthewindowtomatch

I want this to show like:
ForexampleifIhavereallylon
gtextitwillexpandthesizeo
fthewindowtomatch


Is there a way I can do this in CSS or with tags? I could strlen() and cut it manually, but that seems archaic.

JM
Upload video and picture galleries at http://www.bodydot.com?post+upload+video+picture+gallery
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 17th, 2006, 9:14 am

  • orcrist
  • Graduate
  • Graduate
  • User avatar
  • Joined: Apr 02, 2006
  • Posts: 134
  • Status: Offline

Post April 17th, 2006, 9:26 am

for IE you could use word-brake or something like that.
for others, really dont think there is a way to cut word in half with css alone.

have you tried: http://tinyurl.com/ ?
  • Impel GD
  • Professor
  • Professor
  • No Avatar
  • Joined: Oct 26, 2004
  • Posts: 838
  • Loc: Cologne, Germany
  • Status: Offline

Post April 17th, 2006, 4:04 pm

I found How to break a long text string to make it wrap

It involves using a textarea form field - certainly not ideal.
Web and print design
  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Joined: May 29, 2005
  • Posts: 1397
  • Loc: 55° N, 3° W
  • Status: Offline

Post April 18th, 2006, 9:21 am

Is this just a one-off, or a repeating problem?

If it is just a single instance, can't you just insert a few <br>'s?
  • yenerich
  • Student
  • Student
  • No Avatar
  • Joined: Apr 04, 2006
  • Posts: 76
  • Status: Offline

Post April 18th, 2006, 10:01 am

You can use a DIV inside the table and overflow:auto as style and it works.
  • yenerich
  • Student
  • Student
  • No Avatar
  • Joined: Apr 04, 2006
  • Posts: 76
  • Status: Offline

Post April 18th, 2006, 10:02 am

style="word-wrap:break-word" is another possibility

Post April 18th, 2006, 10:02 am

yenerich wrote:
You can use a DIV inside the table and overflow:auto as style and it works.


I tried the div inside but it still expanded the width. I tried overflow:elipse but the documentation says it only works if the parent width is known. I also tried the word-break, but again it says it must know the parent width.

Can you post an example of how you would use a div section with overflow? Maybe it is different than my test.

JM
Upload video and picture galleries at http://www.bodydot.com?post+upload+video+picture+gallery
  • yenerich
  • Student
  • Student
  • No Avatar
  • Joined: Apr 04, 2006
  • Posts: 76
  • Status: Offline

Post April 18th, 2006, 10:16 am

<div style="word-wrap:break-word;width=160px;">
aaaaaaaabbbbbbbbbcccccccccccc dddddddddddddddeeeeeeeeeefffff ggggggggggggggggghhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
</div>
  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Joined: May 29, 2005
  • Posts: 1397
  • Loc: 55° N, 3° W
  • Status: Offline

Post April 18th, 2006, 10:24 am

word-wrap: break-word is an IE-specific piece of css (I pretty sure). Using it
would be a mistake.

Your only options are <br> or some form of scripting.
  • orcrist
  • Graduate
  • Graduate
  • User avatar
  • Joined: Apr 02, 2006
  • Posts: 134
  • Status: Offline

Post April 18th, 2006, 10:28 am

bad news, yenerich ;)


Image
  • yenerich
  • Student
  • Student
  • No Avatar
  • Joined: Apr 04, 2006
  • Posts: 76
  • Status: Offline

Post April 18th, 2006, 10:45 am

Oops!

I never like Mozilla... now have one more reason! :P

There is no way to do it for Mozilla? Have to be one way...

At least you have a way for IE ussers (most of the world), just need to find some for the horrible Mozilla :twisted:

Post April 21st, 2006, 12:26 pm

Here is the best way I finally came up to do it:

http://www.rentyourdot.com/services/pre ... ?style=xxx

Check out the links on the right side

Code: [ Download ] [ Select ]
<div style="position:relative;"><div style="width:100%; position:absolute; top: 0; left 0; overflow:hidden;">
Reallylongtexttexttexttexttexttexttexttexttexttexttexttexttexttext
<div></div>
  1. <div style="position:relative;"><div style="width:100%; position:absolute; top: 0; left 0; overflow:hidden;">
  2. Reallylongtexttexttexttexttexttexttexttexttexttexttexttexttexttext
  3. <div></div>


Not really the best solution, but it seems to work.

JM
Upload video and picture galleries at http://www.bodydot.com?post+upload+video+picture+gallery
  • renuka
  • Born
  • Born
  • No Avatar
  • Joined: Jul 28, 2006
  • Posts: 1
  • Status: Offline

Post July 28th, 2006, 12:09 am

give the solution of wrapping text in to column in mozila browser.it's work in IE using set width of columns

Post Information

  • Total Posts in this topic: 13 posts
  • Users browsing this forum: No registered users and 78 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.