Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

100% of table data, not entire page 1

Status
Not open for further replies.

y2k1981

Programmer
Aug 2, 2002
773
IE
I have the following code:
Code:
<table width=&quot;550&quot;>
<tr><td>Items</td></tr>
<tr><td>
<table>
<tr width=&quot;100%&quot;><td>Item One</td></tr>
<tr width=&quot;100%&quot;><td>Item Two</td></tr>
<tr width=&quot;100%&quot;><td>Item Three</td></tr>
</table>
</td></tr>
</table>
The 100% attribute of the tr in the nested table isn't of the td which contains it, but instead it takes 100% of the screen. Why is this? In IE, when I use this, it's 100% of the td which it's sitting in, but in opera it's not. Why?
 
Try this:
Code:
<table width=&quot;550&quot;>
<tr>
  <td>Items</td>
<!-- omitting </tr> <tr> -->
  <td>
    <table>
       <tr width=&quot;100%&quot;><td>Item One</td></tr>
       <tr width=&quot;100%&quot;><td>Item Two</td></tr>
       <tr width=&quot;100%&quot;><td>Item Three</td></tr>
    </table>
  </td>
</tr>
</table>
-Dave
 
but that will put them beside each other. I want them like this:
Code:
Items
Item1
Item2
Item3
Ok, so why do I need a nested table? Because I want Items1-3 hidden until the user mouses over the word Items (basicly a cascading menu), that's why I need to use a nested table. It works fine for IE, but why won't it work in Opera? Admitidly, it's while since I posted this code, and I think I uninstaled Opera the other day to make room for some other stuff, but shouldn't the
Code:
width=&quot;100%&quot;
just make an object 100% of the object containing it, rather than 100% of the browser window?
 
I don't see that &quot;
Code:
width=x
&quot; is a valid attribute for a Table Row
Code:
<TR>
element. It does seem to be valid, however, for the Table cell
Code:
<TD>
element (although deprecated).

cf. and following section 11.2.6.

Perhaps removing the &quot;
Code:
width=100%
&quot; would achieve the desired effect? I don't have Opera, so don't know why it renders differently than IE, except that it may get confused with a width attribute where one doesn't belong.

To make more visible what an HTML renderer is doing with a table, I find using
Code:
<table border=1 ...>
to be helpful.

I've put up a page with code like your example with the table border. To see w3.org's web validator's evaluation, go to

Hope this helped. ::) -Dave
 
Dave, thanks for your reply. You're probably right there about the width attribute. That's what happens when you get used to coding things for IE

Thanks again for doing all the research, much appreciated and definitely worthy of a star. If I do reinstall Opera I'll let you know the results

Martin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top