Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing text in one line 2

Status
Not open for further replies.

seaport

MIS
Jan 5, 2000
923
US
Limited by the width in a table column, text in the cell always have line break unless it is just one word. How can I force the text in the cell to be in just one line (without any line break)?

Thanks.

Seaport
 
If the text is constant (that is, not coming from a database), replace every space in the text with the string
Code:
 
But if the text is too wide for the cell, part of the text won't show up or the cell will expand to fit the text, breaking your layout, depending on the options in the table directive. If you specify
Code:
style="table-layout:fixed">
the cell contents will not display completely, but your layout is preserved. If you don't, the table cell will expand to accommodate your text, and potentially break your layout.

Mike Krausnick
Dublin, California
 
Alternatively, this should work:
Code:
<table>
<tr>
<td style="white-space:nowrap;">All on one line</td>
</tr>
</table>
[code]
Obviously you can apply that CSS through a stylesheet too.

-- Chris Hunt
[url=http://www.mcgonagall-online.org.uk][i]Webmaster &  Tragedian[/i][/url]
[url=http://www.extraconnections.co.uk]Extra Connections Ltd[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top