Reputation: 99
This is kind a newbie question.
In table cell, if the text is long, how do I make the texts shows in one line ? Never break the line.
The TABLE and TD widths are depends how text long automatically calculated.
For example:
table, td {width: auto}
<table border=0>
<tr>
<td>text text text text text text text text text text text text text text text text text text text text</td>
</tr>
</table>
Upvotes: 0
Views: 74
Reputation: 765
use this -
<style>
table, td {width:auto; white-space: nowrap; overflow-x: scroll; }
</style>
Upvotes: 0
Reputation: 56813
Just apply white-space: nowrap;
on the td
elements:
<table border=0>
<tr>
<td>text text text text text text text text text text text text text text text text text text text text</td>
</tr>
</table>
<style>
table, td {width:auto; white-space: nowrap; }
</style>
Upvotes: 0
Reputation: 2373
You need to use the white-space
property on td
to stop the text wrapping like so:
td {
white-space: nowrap;
}
Upvotes: 2