2013-03-21 167 views
0

如何将YouTube视频嵌入到表格中。我想要左右列是2行高和中间列有2个单元格,我想在底部单元格中的视频,并在顶部的文字,但我无法弄清楚如何将它移动到那里合并表格中的单元格

<div class="cbody"> 
     <table class="ctable"> 
      <tr> 
       <td rowspan="2" style="width:105px"><img class="cimg1" src="meh.png" alt=" " width="100px" height="500px"></td> 
       <td><p class="ctxt"> 
       my text here 
       </p></td> 
       <td rowspan="2" style="width:105px"><img class="cimg2" src="meh.png" alt=" " width="100px" height="500px"></td> 
      </tr> 
      <tr> 
      <iframe width="420" height="315" src="http://www.youtube.com/embed/xI_6oLPC-S0" frameborder="0" allowfullscreen></iframe> 
      </tr> 
     </table> 
    </div> 

和CSS ...

.cbody { 
width:800px; 
margin-left: auto; 
margin-right: auto; 
border-style:solid; 
border-width:3px; 
} 

.cimg1 { 
padding-left:5px; 
padding-top:5px; 
padding-bottom:5px; 
float:left; 
} 

.cimg2 { 
padding-left:5px; 
padding-top:5px; 
padding-bottom:5px; 
float:right; 
} 

.ctxt { 
margin-left:5px; 
margin-right:5px; 
text-align:center; 

} 

.ctable { 
width:800px; 
margin-left:auto; 
margin-right: auto; 
border-style:solid; 
border-width:2px; 
} 

回答

2

您需要添加周围<td>标签,即:

<td> 
    <iframe width="420" height="315" src="http://www.youtube.com/embed/xI_6oLPC-S0" frameborder="0" allowfullscreen> 
    </iframe> 
</td> 

你也应该考虑使用<th>而不是<td>你想放置文字的地方。