Click to See Complete Forum and Search --> : table widths


Count_Rugen
01-30-2003, 08:46 PM
when displaying text in a table cell with a fixed width, the text automatically wraps... but when there are no spaces in the text, the cell width increases until there is. Without writing a function, is there a way to keep the cell width fixed and wrap the text?

gil davis
01-31-2003, 06:08 AM
Browsers require some kind of space to tell them where it is "ok" to break a line. If your text has no spaces in it, the behaviour is "no line break". W3C recommendations include a zero-width space that indicates a separation point - &#x200B. See http://www.w3.org/TR/html4/struct/text.html#h-9.1

jdavia
02-01-2003, 01:58 AM
gil davis,
As a diehard NS user, you might be informed that that only works in IE. I don't have NS 7

Arkki
03-01-2003, 02:39 PM
You can also use a <wbr> tag where there is allowed to be a line break, though I doubt it belongs to any standard.

Stefan
03-01-2003, 03:18 PM
Originally posted by Count_Rugen
Without writing a function, is there a way to keep the cell width fixed and wrap the text?

No, a table is SPECIFICALLY designed to IGNORE size constraints on it if the content in it does not fit.

That is one of the many reasons you should not abuse <table> for general layout.

Use CSS and eg divs and your specified sizes will not be ignored.