Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Markleshark

macrumors 603
Original poster
Aug 15, 2006
6,249
10
Carlisle, Up Norf!
I need a bit of help aligning a table inside a table.

On this page you can see my red box, which I need to align to the top of the outer table with no borders or spaces, how would I do that?

Code:
<table align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20" background="./images/border_l.gif"> </td>
    <td width="700" height="500" bgcolor="#eaeaea"><p> </p>
	
	<table align="center" border="0" cellspacing="0" cellpadding="0">
	<td width="500" bgcolor="#ff0000" valign="top" >Hullo?</td>
	</table>
    
	</td>
    <td width="20" background="./images/border_r.gif"> </td>
  </tr>
</table>

Thats the code for the whole of the table setup so far.

Any help appreciated, thanks.
 
Try this:

Code:
<table align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20" background="./images/border_l.gif"> </td>
    <td width="700" height="500" bgcolor="#eaeaea" [B]align="top"[/B]><p> </p>
	
	<table align="center" border="0" cellspacing="0" cellpadding="0">
	<td width="500" bgcolor="#ff0000" valign="top" >Hullo?</td>
	</table>
    
	</td>
    <td width="20" background="./images/border_r.gif"> </td>
  </tr>
</table>
 
That doesn't work. That bit is actually the main big grey table, it's the red one inside that I need to move. As you can see in my original code, I've tried valign but that doesnt work either.
 
That doesn't work. That bit is actually the main big grey table, it's the red one inside that I need to move. As you can see in my original code, I've tried valign but that doesnt work either.

Yeah, you're right.

But here's the thing: you don't need to worry about the table inside, you need to worry about the cell holding the table inside. you need to align the contents of the cell.... let me mess around.
 
Yeah, you're right.

But here's the thing: you don't need to worry about the table inside, you need to worry about the cell holding the table inside. you need to align the contents of the cell.... let me mess around.

Ok, thanks. I'll let you know if I get anything myself.
 
Second thought....

Try using CSS coupled with a <div> tag.... I vaguely remember something like this in a Web Centric Computing course I took in college.
 
This seems to work,
Code:
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
  <td background="./images/border_l.gif" width="20"> </td>
  <td bgcolor="#eaeaea" height="500" width="700" [B]valign="top"[/B]> [B]<!-- p tag was here -->[/B]
	
     <table align="center" border="0" cellpadding="0" cellspacing="0">
       <tbody><tr><td bgcolor="#ff0000" width="500">Hullo?</td>
       </tr></tbody></table>
    
  </td>
  <td background="./images/border_r.gif" width="20"> </td>
</tr>
</tbody></table>
 
This seems to work,
Code:
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
  <td background="./images/border_l.gif" width="20"> </td>
  <td bgcolor="#eaeaea" height="500" width="700" [B]valign="top"[/B]> [B]<!-- p tag was here -->[/B]
	
     <table align="center" border="0" cellpadding="0" cellspacing="0">
       <tbody><tr><td bgcolor="#ff0000" width="500">Hullo?</td>
       </tr></tbody></table>
    
  </td>
  <td background="./images/border_r.gif" width="20"> </td>
</tr>
</tbody></table>

I did try that...hmm.

Good work!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.