...

View Full Version : Input width within table



siamraf
06-29-2007, 01:56 PM
Hi,

I need to place input fields within a table, and want their width to expand to the width of the column... The following seems to work within IE, but in Firefox, the input fields actually expand the width of the table to be 100% of the screen... I thought when setting the width of the input to 100%, it would have been with respect to the parent TD element it was placed within... Why is it actually resizing the TD too?


<html>
<head>
</head>
<body>

<table border="1">
<tr style="font-weight: bold;">
<td width=100>Name</td>
<td>Id</td>
<td>Item</td>
<td>Time</td>
<td>Date</td>
<td>Tier</td>
<td>Status</td>
<td>Comments</td>
</tr>

<tr>
<td><input style="width:100%"></td>
<td><input style="width:100%"></td>
<td><input style="width:100%"></td>
<td><input style="width:100%"></td>
<td><input style="width:100%"></td>
<td><input style="width:100%"></td>
<td><input style="width:100%"></td>
<td><input style="width:100%"></td></tr>

</table>
<br>
</body></html>

Cheers

Siam

PappaJohn
06-29-2007, 04:57 PM
You don't have a width set for the <table>

koyama
06-30-2007, 11:54 PM
Remember that CSS 2.1 does not define the meaning of a percentage width for an element whenever the containing block's width depends on the width of that element. This is the case for elements within a table cell in the automatic table layout.

Maybe you should instead find some kind of compromise such as explicitly setting the width of each input element to a value that makes it just a bit wider than the column heading.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum