PDA

View Full Version : Table Align Help.




Markleshark
Mar 14, 2008, 10:17 AM
I need a bit of help aligning a table inside a table.

On this (http://www.markleshark.com/new/) 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?


<table align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" background="./images/border_l.gif">&nbsp;</td>
<td width="700" height="500" bgcolor="#eaeaea"><p>&nbsp;</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">&nbsp;</td>
</tr>
</table>


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

Any help appreciated, thanks.



brn2ski00
Mar 14, 2008, 10:20 AM
Try this:


<table align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" background="./images/border_l.gif">&nbsp;</td>
<td width="700" height="500" bgcolor="#eaeaea" align="top"><p>&nbsp;</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">&nbsp;</td>
</tr>
</table>

Markleshark
Mar 14, 2008, 10:31 AM
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.

brn2ski00
Mar 14, 2008, 10:47 AM
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.

Markleshark
Mar 14, 2008, 10:58 AM
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.

brn2ski00
Mar 14, 2008, 11:16 AM
Try using CSS coupled with a <div> tag.... I vaguely remember something like this in a Web Centric Computing course I took in college.

angelwatt
Mar 14, 2008, 12:19 PM
This seems to work,
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td background="./images/border_l.gif" width="20">&nbsp;</td>
<td bgcolor="#eaeaea" height="500" width="700" valign="top"> <!-- p tag was here -->

<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">&nbsp;</td>
</tr>
</tbody></table>

Markleshark
Mar 14, 2008, 12:30 PM
It does. Thanks angelwatt.

brn2ski00
Mar 14, 2008, 01:52 PM
This seems to work,
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td background="./images/border_l.gif" width="20">&nbsp;</td>
<td bgcolor="#eaeaea" height="500" width="700" valign="top"> <!-- p tag was here -->

<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">&nbsp;</td>
</tr>
</tbody></table>

I did try that...hmm.

Good work!

Markleshark
Mar 15, 2008, 03:22 AM
I did try that...hmm.

Good work!

I think the <p> tags we're breaking it.

Thanks for your help as well brn2ski00.