Table Align Help.

Discussion in 'Web Design and Development' started by Markleshark, Mar 14, 2008.

  1. Markleshark macrumors 603

    Markleshark

    Joined:
    Aug 15, 2006
    Location:
    Carlisle, Up Norf!
    #1
    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.
     
  2. brn2ski00 macrumors 68020

    brn2ski00

    Joined:
    Aug 16, 2007
    #2
    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>
    
     
  3. Markleshark thread starter macrumors 603

    Markleshark

    Joined:
    Aug 15, 2006
    Location:
    Carlisle, Up Norf!
    #3
    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.
     
  4. brn2ski00 macrumors 68020

    brn2ski00

    Joined:
    Aug 16, 2007
    #4
    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.
     
  5. Markleshark thread starter macrumors 603

    Markleshark

    Joined:
    Aug 15, 2006
    Location:
    Carlisle, Up Norf!
    #5
    Ok, thanks. I'll let you know if I get anything myself.
     
  6. brn2ski00 macrumors 68020

    brn2ski00

    Joined:
    Aug 16, 2007
    #6
    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.
     
  7. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #7
    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>
     
  8. Markleshark thread starter macrumors 603

    Markleshark

    Joined:
    Aug 15, 2006
    Location:
    Carlisle, Up Norf!
  9. brn2ski00 macrumors 68020

    brn2ski00

    Joined:
    Aug 16, 2007
    #9
    I did try that...hmm.

    Good work!
     
  10. Markleshark thread starter macrumors 603

    Markleshark

    Joined:
    Aug 15, 2006
    Location:
    Carlisle, Up Norf!
    #10
    I think the <p> tags we're breaking it.

    Thanks for your help as well brn2ski00.
     

Share This Page