Table cell max width

liunx

Guest
How can I set the maximum width of a table cell. The field width will vary depending on what characters are display. For example, W's will expand the field wider than I and make the fields to the right go to double lines. Try width="180" but it did not work.<br />
Any help or advice would be greatly appreciated.<!--content-->There's nothing that you can do about that. Tables are for organizing data and not intended for controlling layout. You are supposed to use CSS for that.<!--content-->Basically what Charles was saying the table cells can be set to a specific pixel width in HTML although to try and imposes a 'maximum size' you would use CSS similar to the following:<br />
<br />
<style type=鏀杄xt/css?gt;<br />
<!--<br />
td{max-width: 180px;}<br />
--><br />
</style><br />
<br />
Also as he rightly pointed out tables are actually designed for displaying and accommodating tabular data rather than positioning text and graphics, etc.<!--content-->The command max-width is not supported by any browsers.<br />
This according to my tests (if I am writing the code correctly) and Osborne's The Complete Reference HTML Third Edition.<br />
<br />
Any other suggestions/ideas?<br />
<br />
Thank you in advance<!--content-->Put your text inside a <div> and set the style up like this:<br />
<br />
<div style="width: 180px; overflow:hidden;"><br />
<br />
That will, of course, hide any content that goes beyond the 180px...<!--content-->Tried that didn't work. Where would I put this <div> tag.<br />
I tried in the asp doc only and not in the style sheet.<br />
<br />
The original line reads is the asp doc:<br />
response.write("<td id=""twelve"">" & objrs("field12") & "&nbsp;</td>")<br />
<br />
The related line reads in the css doc:<br />
#twelve {width: 180;<br />
color: black;<br />
font-family: Arial:<br />
text-align: left;<br />
font: 10pt;<br />
font-weight: normal;<br />
font-style: normal;<br />
background-color: white;}<br />
<br />
I tried:<br />
response.write("<div style=""width: 180px; overflow:hidden;""><td id=""twelve"">" & objrs("field12") & "&nbsp;</td></div>")<!--content-->
 
Back
Top