By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,912 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,912 IT Pros & Developers. It's quick & easy.

table alignment problem

P: n/a
Hi.

I'd like a little help working out what is going on with what should
be a simple alignment problem.

I have an outer table with a <td> which has an inner table.

The <td> specified as width=200 has the inner table which is
width=100%

But I can't make the inner table appear as 100% the width of the cell
unless the cell is at least half the width of the outer table.

If this is normal behaviour, why is it like that? It kinda defies my
view of logic.

<body>

<table width="780" border="1">
<tr>
<td width="200">

<table bgcolor="#FF0000" width="100%" border="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

</td>
<td width="394">&nbsp;</td>
</tr>
</table>

</body>

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Andy Flash" <An*************@tpg.com.au> wrote in message
news:k2********************************@4ax.com...
Hi.

I'd like a little help working out what is going on with what should
be a simple alignment problem.

I have an outer table with a <td> which has an inner table.

The <td> specified as width=200 has the inner table which is
width=100%

But I can't make the inner table appear as 100% the width of the cell
unless the cell is at least half the width of the outer table.

If this is normal behaviour, why is it like that? It kinda defies my
view of logic.

<body>

<table width="780" border="1">
<tr>
<td width="200">

<table bgcolor="#FF0000" width="100%" border="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

</td>
<td width="394">&nbsp;</td>
</tr>
</table>

</body>


I think you'll find the behaviour is browser-dependent. Firefox behaves the
way you expected, IE doesn't.
--
David Biddulph
Jul 23 '05 #2

P: n/a
Andy Flash <An*************@tpg.com.au> wrote:
I have an outer table with a <td> which has an inner table.
http://dorward.me.uk/www/nested/
The <td> specified as width=200 has the inner table which is
width=100%

But I can't make the inner table appear as 100% the width of the cell
unless the cell is at least half the width of the outer table.

<table width="780" border="1">
<tr>
<td width="200">
<table bgcolor="#FF0000" width="100%" border="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</td>
<td width="394">&nbsp;</td>
</tr>
</table>


200 + 394 = 594
594 < 780
How is the browser supposed to lay out the main table?

There are a few guidelines to remember:
* cell widths are just suggestions, browsers should ignore them if the
content doesn't fit.
* table widths tend to be given higher priority then cell widths

What I think IE is doing is that it is setting the inner table to be
200px wide, 100% of 200px is 200px. But because 594 != 780 it is then
adjusting the widths of the outer table cells to meet the specified
table width. But it is not keeping the width of the inner table to the
previously defined amount.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.