Why is it that when data is larger than the width the column becomes large?

liunx

Guest
Hi all,<br />
<br />
I've got a question regarding tables.<br />
I have a table but when the data is larger than the width it makes the column larger - but I want the column<br />
width to stay the same.<br />
<br />
I tried specifying the td tag by saying <TD WIDTH="50%"> and when that didn't work : <TD WIDTH="50"><br />
The column becomes larger when the data is entered.<br />
<br />
Any suggestions anyone?<br />
<br />
Many thanks for any help.<!--content-->Contary to popular belief it is not possible to totally fix the width or height of a table. You can set parametres but if your content exceeds this then the table data box will expand to meet this requirement. There are many ways of making mistakes that will result in this happening.<br />
<br />
The most common of which is the way <td>s are laid out. Open and close them on the same line of carriage with no spaces between them. i.e.<br />
<br />
<td>some stuff here</td><br />
<br />
and not<br />
<br />
<td><br />
some stuff here<br />
</td><br />
<br />
In the second example you have white space, which your browser will recognise and try to fit in to the td cell. Avoid this by following the first example. If you have any problems post your html source and I or somene else will have a look at it for you.<!--content-->myself, show us the complete code for the whole page (not just the table), because text alone is unlikely to push your cell wider than you've defined.<br />
<br />
It can depend on what you actually have in the cell and what you have in the cells surrounding it. You can get the width set exactly using <td width="50"> but some elements (e.g. textarea, blockquote, etc) can force that apart. <td width="50%"> is more likely to change width simply because it's a relative value.<br />
<br />
Neil<!--content-->There was a post somewhere on this board, in the last few weeks, that showed how to nest one table inside another so that the cell wasn't stetched. There is also an article at evolt.org, on liquid layout that has some helpful tips as well.<!--content-->
 
Back
Top