Sent by Jukka K. Korpela on 25 January 2005 18:06
On Tue, 25 Jan 2005, Sebastian Redl wrote:
> In theory, the "nowrap" value of the white-space property achieves that.
> In practice, I don't think any browser actually implements it.
The declaration white-space: nowrap is well supported for table cells as
well. You can test e.g. the following:
<table border="1">
<tr><td style="white-space: nowrap">This is a cell containing many words.
It will probably be wrapped unless you do something about it.</span></td>
<td>This is another cell in the same table.</td></tr>
</table>
The CSS rule has the same effect as the nowrap attribute.
However, if you set a width for the cell, then most browsers seem to
ignore the attempt to prevent wrapping, if that would mean exceeding the
suggested width. But this applies to the nowrap attribute as well.
Hopefully you can avoid setting the width. If cannot, you could use the
workaround of adding artificial inner markup like
<td><span style="white-space: nowrap">...</span></td>
though of course this would mean asking the browser exceed the suggested
width when needed.
If the cell content is something simple, you could also deploy the non-CSS
method of using no-break spaces instead of normal spaces in the cell
content. All the following have basically the same meaning:
<td nowrap>100 km</td>
<td style="white-space: nowrap">100 km</td>
<td>100 km</td>
--
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/