Very simple, as you see. However, something is wrong here.... notice that the div has the same witdh that the td, and because this the width of td should be the same as the div, but this is not occuring. As you can see, the td width is being expanded until the big string ends, and I do not want this. I want the td in the same width as the div (here, 50px), and not with the width of the big string. Got it??
Make a test... change the "width: 100%" style of div to something like "width: 100px;", and it will work. But the fact is that i need this width to be in percentage, because this table is being created dinamically.
I hope I could be very transparent in my explanation, and sorry about my english... I´m brazillian. :)
Lets me first congrats you of using overflow:hidden as the solution :) Yes, that is the only way round.
There is no real fix for IE Expnding Box behavior (float drop), excpt to work around or avoid it. <!--[if IE]> <style type="text/css"> body {word-wrap: break-word;} </style> <![endif]-->
In short, both word-wrap: break-word & overflow: hidden are only possible workarounds that will make IE respect your specified width and dimension.
Hum... just as I thought, there´s no way to fix it...
The problem in fact is that this table is only an example. In my project, this is one of some table that will be created dinamically by a xml. And more, after the creating of all tables, the project have a zoom tool that expands all tables and divs inserted into their columns. That´s the reason i´ve put a % width on the div, and not a fixed value.
I could do this zoom fix with javascript dinamically, but the result was too slow because a for instruction that run all the divs and resize all of them...
In another words... I have to negotiate again with my client, and search for another solution for this, I guess.... hehe
In spite of this... thank you so much for the help!! I think putting the style in body by css is the best way.
better then DOM (if JS disabled) is to create small PHP function or whatever scripting you may be using and which will add ( - hyphen) after certain characters. Filter-out all words using this function. This will work in any circumstances.