Ivo wrote:
Consider a table with a number of rows, each containing a
short text (label) on the left and an input control on the
right. Some inputs are of type text and others of type
checkbox. I would like the cells with the checkboxes to be
as narrow as possible (square) but in this table the
"width=10" bit seems to get ignored:
<table border="1">
<tr>
<td>some text</td>
<td colspan="2"><input type="text"></td>
</tr>
<tr>
<td colspan="2">more text</td>
<td width="10"><input type="checkbox"></td>
</tr>
</table>
What am I doing wrong?
Nothing, really, (I think!), but you didn't define the "middle
cell".
If you put this:
<tr><td></td><td></td><td></td></tr>
right above the first <tr>, it does work in Firefox.
Colspan is a bit tricky, and different browsers act
differently with it.
I've learned to set all widths in the first line which has
only td's without colspan, then use colspan as you see fit on
the cells in the rows below.
You can make that first row invisible if you'd use CSS.
Like this:
In the <head>
<style type="text/css">
table, td {border:1px solid black}
tr.invisible td{border:0px;}
</style>
In the <body>
<table style="width:300px;">
<tr class="invisible"><td style="width:100px;"></td><td
style="width:190px;"></td><td style="width:10px"></td></tr>
<tr>
<td>some text</td>
<td colspan="2"><input type="text"></td>
</tr>
<tr>
<td colspan="2">more text</td>
<td><input type="checkbox"></td>
</tr>
</table>
hth
--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Meredith Brooks - I'm A Bitch