3 replies [Last post]
dcbohn
Offline
newbie
Last seen: 16 years 25 weeks ago
Joined: 2003-03-21
Posts: 4
Points: 0

Does anyone how a method to keep the browser from breaking a hyphenated word on to 2 seperate lines in a table cell?

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 5 days 12 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Preventing line breaks in a cell

Hi Dcbohn,
It might be helpful to see an example of this as the table setting may have some effect on the result.
I think by default the word should stretch the table until the next space. That is if there are no spaces around the hyphen. Netscape seems to handle this correctly. ie looks like it will break it on a hyphen if there are no spaces around. You could try setting word-wrap:normal; although this is the default and the only other option is break-word.
#-o
Another thing to try would be wrap the contents in a span, or if the word really needs to stay together force a break before it <br />.

Hopefully someone else will find a better solution.
Good luck.

Damian
Offline
newbie
South Africa
Last seen: 16 years 25 weeks ago
South Africa
Timezone: GMT+1
Joined: 2003-03-27
Posts: 3
Points: 0

Preventing line breaks in a cell

Try this, though I must warn you its not WC3 recomended.
use the <nobr>whatever you dont want broken</nobr> tags.

florent
florent's picture
Offline
Enthusiast
Paris, France
Last seen: 12 years 41 weeks ago
Paris, France
Timezone: GMT+1
Joined: 2003-04-19
Posts: 96
Points: 0

Preventing line breaks in a cell

not sure this is recommended as well...

use the attribute nowrap for the td element...

<td nowrap>your text that won't break</td>

I'm a perfectionist
and perfect is a skinned knee