Moving tables. HTML question?

2008-01-19 4:56 pm
http://www.ivoog.com/link

See the two "square boxes" on the left of the page? See how the first one is about 5px from the big long box on the top? How can I make the second box be 5px from the bottom of the first "square box"?

I tried putting in margin-top:5px into the style of that section of the table but it didn't work. How can I do it? Please explain or edit the code. Thanks!

回答 (6)

2008-01-19 11:37 pm
✔ 最佳答案
The only way I could get this to work is to enter new tables in the cells where you have the boxes. I this way, you can simply adjust the padding value in the lower box to put some distance between the two boxes in the same column. The code looks like this;

<table width="100%" style="margin-top:5px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="232" height="189" valign="top"><table width="232" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="1" width="100%" height="188">
<tr>
<td background="http://www.pics.ivoog.com/b001.gif"> </td>
</tr>
</table>
</td>
<td rowspan="2" valign="top"><table width="99%" style="border-top:2px; border-bottom:2px; border-top-style:solid; border-bottom-style:solid; margin-top:2px; margin-left:10px; border-color:#FFCC00; background-color:#FFEDA3" cellpadding="2" cellspacing="0">
<tr>
<td nowrap="nowrap"><span class="style3">User Agreement</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="232" height="189" valign="top" style="padding-top: 5px">
<table border="0" cellpadding="0" cellspacing="1" width="100%" height="190">
<tr>
<td background="http://www.pics.ivoog.com/b001.gif"> </td>
</tr>
</table>
</td>
</tr>
</table>

You will notice that the cells contained within the two separate tables must be given a height value. As long as this value is the same for both boxes, they look to appear identical on the page.
2016-04-06 2:33 pm
Sorry, but the code snippet you have given is not sufficient. Moving the table up the page depends on moving the other stuff on the page out of the way.
2008-01-19 6:56 pm
you add a margin @ the top

style="margin:5px 0px 0px 0px;"
2008-01-19 6:26 pm
Best thing you could do is not use tables for web design. Just for displaying data.
2008-01-19 5:18 pm
All you need to do is add this just before the last <tr> in your current code:

<tr><td style="height:5px"></td></tr>
2008-01-19 5:10 pm


收錄日期: 2021-05-02 16:54:13
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080119085605AAmV1gN

檢視 Wayback Machine 備份