Jump to content

table alignment


ironman32

Recommended Posts

I'm trying to align these tables in this format

 

Session 1          Session 2

 

 

 

Session 3          Session 4

 

Here is the code for the tables

Session 1
<table border="1">
<tr><td>Stretch/Warm up</td></tr>
<tr><td><?php echo $input[$rand_keys[0]] . "\n";?></td></tr>
<tr><td><?php echo $input1[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input2[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input3[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input4[$rand_keys[0]] . "\n";?></td></tr>
</table>
<p>


Session 2
<table border="1" >
<tr><td>Stretch/Warm up</td></tr>
<tr><td><?php echo $input[$rand_keys[0]] . "\n";?></td></tr>
<tr><td><?php echo $input1[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input2[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input3[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input4[$rand_keys[0]] . "\n";?></td></tr>
</table>
</p>

Session 3
<table border="1" >
<tr><td>Stretch/Warm up</td></tr>
<tr><td><?php echo $input9[$rand_keys[0]] . "\n";?></td></tr>
<tr><td><?php echo $input10[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input11[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input12[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input13[$rand_keys[0]] . "\n";?></td></tr>
<tr><td><?php echo $input14[$rand_keys[0]] . "\n";?></td></tr>
</table>

Session 4
<table border="1" >
<tr><td>Stretch/Warm up</td></tr>
<tr><td><?php echo $input15[$rand_keys[0]] . "\n";?></td></tr>
<tr><td><?php echo $input16[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input17[$rand_keys[1]] . "\n";?></td></tr>
<tr><td><?php echo $input18[$rand_keys[1]] . "\n";?></td></tr>
</table>

 

Could anyone give me some guidance on this please?

Link to comment
Share on other sites

that float works well till you start to have diffrent size monitors, like older ones, and newer wide screen, then setting the table size to 50% seems to change everything relative to sizes.

 

the page may not always look correct on diff monitors....

 

the other fix is to create a master table that would include the four smaller tables as table data.

 

this lets you make a table with four columns wide and then you can specify the size of the middle to and not the outer two.

 

<table border="1" width="100%">
<tr><td></td><td width="size">1</td><td width="size">2></td><td></td></tr>
<tr><td></td><td width="size">3</td><td width="size">4></td><td></td></tr>
</table>

 

this lets the outside columns adjust to compensate for diff monitors and keeps your tables correct.

 

Link to comment
Share on other sites

the other fix is to create a master table that would include the four smaller tables as table data.

You shouldn't try to solve tables with more tables.  Simply create a wrapper div with 100% width while setting the tables' width to 50%.

Link to comment
Share on other sites

that float works well till you start to have diffrent size monitors, like older ones, and newer wide screen, then setting the table size to 50% seems to change everything relative to sizes.

 

the page may not always look correct on diff monitors....

 

the other fix is to create a master table that would include the four smaller tables as table data.

 

this lets you make a table with four columns wide and then you can specify the size of the middle to and not the outer two.

 

<table border="1" width="100%">
<tr><td></td><td width="size">1</td><td width="size">2></td><td></td></tr>
<tr><td></td><td width="size">3</td><td width="size">4></td><td></td></tr>
</table>

 

this lets the outside columns adjust to compensate for diff monitors and keeps your tables correct.

 

 

That argument doesn't make much sense.  First, from what I can see he is trying to use a table for what it was meant for, and that is displaying tabular data, not for layout purposes.  Now of course when creating anything fluid you have to consider different size real estate, that is basically the point of using percents, so things can stretch and collapse. 

 

What I gave was an example of how to achieve an effect and that is by using a float.  He can just as easily used fixed sizes for the tables and could wrap them in a div, but without knowing more about the page and how it was set up, it is simply easiest to provide an example.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.