2013-02-01 103 views
0

我正在制作HTML5表格,并且我希望在另外两个单元格上放置一个单元格。桌子内有iframe。我也希望它在任何单元格之间没有间距(没有边框或任何东西)谢谢。HTML5表1单元格覆盖两个单元格

我迄今为止代码:

<table border="0"> 
    <tr> 
     <th> 
      <iframe frameborder="100" src="./top.htm" width="900" height="108" scrolling="no" seamless="seamless"></iframe> 
     </th> 
    </tr> 
     <td> 
      <iframe src="./left.htm" name="link1" width="160" height="700" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" seamless="seamless"> </iframe> 
     </td> 
     <td> 
      <iframe src="./home.htm" name="link2" width="740" height="700" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" seamless="seamless"></iframe> 
     </td> 
</table> 
+0

你有两个td不在'tr'里面,我不认为这在HTML 5中甚至是有效的。另外,你的意思是“一个细胞在另外两个细胞”? – Passerby

+0

就好像上排有所有细胞合并在一起。截至目前与我的代码,它将左边的iframe放置在顶部,然后它将家庭iframe放在顶部的右边,并在其下面 –

+0

我打算在人们回答时发表评论...检查下面的答案,它只是一个简单的'colspan'属性。更多信息可以在这里找到(https://developer.mozilla.org/en-US/docs/HTML/Element/td)。 – Passerby

回答

0

我只是猜测你正在寻找的答案是排在最前面的colspan--但不清楚你的问题实际上是在问什么。

你的表的代码是无效的,所以你应该做的第一,但基本上你想要做的是这样的:

<table cellpadding="0" cellspacing="0"> 
    <tr> 
     <td colspan="2">TOP ROW CONTENT</td> 
    </tr> 
    <tr> 
     <td>LEFT CONTENT</td> 
     <td>RIGHT CONTENT</td> 
    </tr> 
</table> 

cellpaddingcellspacing设置为0的table将删除单元格周围和之间的空间)

+0

非常感谢!那正是我所期待的。对不起,我不清楚我的问题 –

0

为了使细胞跨度2列使用colspan属性在tdth

<table border="0"> 
    <tr> 
     <th colspan="2"> 
      <iframe frameborder="100" src="./top.htm" width="900" height="108" scrolling="no" seamless="seamless"></iframe> 
     </th> 
    </tr> 
    <tr> 
     <td> 
      <iframe src="./left.htm" name="link1" width="160" height="700" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" seamless="seamless"> </iframe> 
     </td> 
     <td> 
      <iframe src="./home.htm" name="link2" width="740" height="700" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" seamless="seamless"></iframe> 
     </td> 
    </tr> 
</table> 

另外,还要确保你所有的tdth标签在tr行标记内。

+0

谢谢!这工作! –