Jump to content

Recommended Posts

Posted

I need some help with tables. Let's say I have this:

 

><table>
 <tr>
   <td>
     <table>
       <tr>
         <td>Some stuff, table 1</td>
       </tr>
       <tr valign="bottom">
         <td>Some more stuff, table 1</td>
       </tr>
     </table>
   </td>
   <td>
     <table>
       <tr>
         <td>Some stuff, table 2</td>
       </tr>
       <tr>
         <td>Some more stuff, table 2</td>
       </tr>
       <tr valign="bottom">
         <td>Even more stuff, table 2</td>
       </tr>
     </table>
   </td>
 </tr>
</table>

 

I want the last rows of table 1 and 2 to line up along the bottom and that isn’t what I end up with.

 

I know how to set the height of table 1 and 2 to 100%, but that seems to auto-adjust the height of the two rows in table 1. I would rather only the bottom row be the one that is adjusted.

 

I also know I can just put the last row of table 1 and 2 in a row for the main table, that doesn't really doesn't solve my problem since I need table 1 and 2 to remain whole.

 

Lastly, I know I can fix the height of all the rows except the last row of table 1 and 2, and set the table’s heights to 100%. I really don’t want to fix the height of the rows since the content of each row could exceed the fixed height.

 

Is there any way to auto-adjust only one row? Any other ideas?

Posted (edited)

Try this to line up the rows

 

<table>

<tr>

<td> </td>

</tr> <tr>

<td>Some stuff, table 1</td>

</tr>

<tr valign="bottom">

<td>Some more stuff, table 1</td>

</tr>

. . .

Edited by jwbowden
Posted

That works, until this happens:

><table border="2">
<tr valign="top">
  <td>
    <table border="2">
      <tr>
        <td>Some stuff, table 1</td>
      </tr>
      <tr>
        <td> </td>
      </tr>
      <tr valign="bottom">
        <td>Some more stuff, table 1</td>
      </tr>
    </table>
  </td>
  <td>
    <table  border="2">
      <tr>
        <td>Some stuff, table 2</td>
      </tr>
      <tr>
        <td>
          Some more stuff, table 2<br />
          Second line of stuff in this cell.
        </td>
      </tr>
      <tr valign="bottom">
        <td>Even more stuff, table 2</td>
      </tr>
    </table>
  </td>
</tr>
</table>

 

This is what happens.

post-4492-1115520405_thumb.jpg

 

I always want the bottom rows of table 1 and 2 to be in line. The page I am working on, the content of both tables can vary.

Guest Serpentine
Posted

Forgive me for sounding stupid but...

 

Why have two tables when you can have one divided? One table with multiple colums and rows and the bottom will always be aligned. I dont think they line up because the middle one on the left has only one row and the right one has two rows of text.

Posted
Forgive me for sounding stupid but...

 

Why have two tables when you can have one divided?  One table with multiple colums and rows and the bottom will always be aligned.  I dont think they line up because the middle one on the left has only one row and the right one has two rows of text.

I'm not sure I understand, rookie html person here. Can you give me an example?

 

Maybe this might be a better explanation. I am writing a PHP script to generate a web page. Table 1 is going to be for site navigation and table 2 is going to contain the main site information. Both tables are generated by the script, that is why the information may vary. The last row for table 1 will be for the site update date, and the last row for table 2 will be for the site copyright information.

 

I understand now that I might be going at it the wrong way with using two tables, I am open to other suggestion.

Posted (edited)

Apologies to all - messed up the attachment on the previous post and didn't have an "edit" button!

 

I always want the bottom rows of  table 1 and 2 to be in line.  The page I am working on, the content of both tables can vary.

 

serpentine is right - you're better off using a single table (from what we know at this point).

 

><table cellspacing="2" cellpadding="2" border="2">
<tr>
<td>Some stuff nav 1</td>
<td>some stuff content 1</td>
</tr>
<tr>
<td rowspan="2"> </td>
<td>some stuff content 2</td>
</tr>
<tr>
<td>some stuff content 3</td>
</tr>
<tr>
<td>Some stuff nav 2</td>
<td>some stuff content 4</td>
</tr>
</table>

 

 

post-5741-1115652649_thumb.jpg

Edited by jwbowden
Guest Serpentine
Posted

Thats it John. I got too lazy to post the results after the last post and then forgot about it. You can then use PHP includes to populate the individual cells.

Posted

Thanks John & Serpentine:

 

I really need to have two separate tables, the project I have started working on will only truly work as two tables. Without letting the "cat out of the bag" table 2 is already being generated by "script 1". What I am working on is table 1, it will generate a navigation system for table 2. Any change to the "two table concept" will require a significant change to "script 1" and I cannot do that. Right now, the changes required to "script 1" for using "two tables" are minor (adding the "table", "tr" and "td" open and closed tags).

 

I think, at this point I am going to not worry about the bottom of the two tables always lining up. It would have given the two tables a cleaner look, but everything will still function if they don't line up. I might come back to this problem after I get everything else working.

Posted

If you were willing to let at least the cat's "nose" out of the bag, so to speak, I'm sure that there is more than one solution to your problem. But without having more information, we can't really help you look at your problem from a different perspective.

 

In reality, with CSS, you might not need to use tables at all. But we don't know that because we can't see the scripts you're trying to run. :lol:

 

Best of luck with your project.

Posted

If you have to use this nested layout, why not move the copyright and update info to its own row within the master table --

 

<table>

 

<tr>

<td><sub table 1></td>

<td><sub table 2></td>

</tr>

 

<tr>

<td colspan="2">Copyright and Update info</td>

</tr>

 

</table>

 

Even if your PHP script retrieves copyright/update info from the database early on, it should be easy to store that information until you need to pop it in the footer.

Posted
If you were willing to let at least the cat's "nose" out of the bag, so to speak, I'm sure that there is more than one solution to your problem. But without having more information, we can't really help you look at your problem from a different perspective.

 

In reality, with CSS, you might not need to use tables at all. But we don't know that because we can't see the scripts you're trying to run. :group:

 

Best of luck with your project.

You are right; however I really don't want to say to much about the project I am working on because I don't want people (although probably nobody here) to say "are you done yet?" I am just a hobbyist and I play around with PHP after I get the kid to bed on the nights my wife works. So I have no actual date for completion.

 

The must import thing that really is needed to be known is what I explained in my posts. That an existing script is generating "table 2", the overall height of which can be changed (however it can be predicted, it just takes allot more work to do so and will more then triple the complexity of the PHP script). Table 1, is what my script will generate and will be an add-on navigation menu for table 2.

 

I admit it; I was just trying find a "lazy" solution for getting the bottom of table 1 and table 2 to line up. At this point, it doesn't sound like there is an easy solution to do it. I'll come back to it later or just adjust my layout and concept.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...