Click to See Complete Forum and Search --> : Table cell max width
mikey1000
05-08-2003, 10:10 AM
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.
Any help or advice would be greatly appreciated.
Charles
05-08-2003, 10:29 AM
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.
Robert Wellock
05-08-2003, 03:11 PM
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:
<style type=”text/css”>
<!--
td{max-width: 180px;}
-->
</style>
Also as he rightly pointed out tables are actually designed for displaying and accommodating tabular data rather than positioning text and graphics, etc.
mikey1000
05-14-2003, 01:11 PM
The command max-width is not supported by any browsers.
This according to my tests (if I am writing the code correctly) and Osborne's The Complete Reference HTML Third Edition.
Any other suggestions/ideas?
Thank you in advance
Put your text inside a <div> and set the style up like this:
<div style="width: 180px; overflow:hidden;">
That will, of course, hide any content that goes beyond the 180px...
mikey1000
05-14-2003, 02:16 PM
Tried that didn't work. Where would I put this <div> tag.
I tried in the asp doc only and not in the style sheet.
The original line reads is the asp doc:
response.write("<td id=""twelve"">" & objrs("field12") & " </td>")
The related line reads in the css doc:
#twelve {width: 180;
color: black;
font-family: Arial:
text-align: left;
font: 10pt;
font-weight: normal;
font-style: normal;
background-color: white;}
I tried:
response.write("<div style=""width: 180px; overflow:hidden;""><td id=""twelve"">" & objrs("field12") & " </td></div>")