html - 表格对齐问题html

标签 html css html-table

<table width="100%" border="0">
  <table width="600" align="center" bgcolor="#ffffff">
     <tr>
       <td width="600" colspan="120">Banner Image</td>
     </tr>
     <tr>
        <td width="400" colspan="80"></td>
        <td width="10" colspan="2" bgcolor="yellow"></td>
        <td width="190" colspan="38"></td>
     </tr>
  </table> 
</table>

第二行对齐困惑。如何解决?

最佳答案

看来这里有很多问题。

首先,这不是有效的 html。第二个表格标签不能放在你拥有它的地方。您需要执行以下操作:

<table width="100%" border="0">
    <tr><td>
    <table width="600" align="center" bgcolor="#ffffff">
        <tr>
            <td width="600" colspan="3">Banner Image</td>
        </tr>
        <tr>
            <td width="400"></td>
            <td width="10" bgcolor="yellow"></td>
            <td width="190"></td>
        </tr>
    </table>
</td></tr>
</table>

这可能会解决您眼前的问题。但是,你到底为什么要有 120 列?从任何标准来看,这似乎都是错误的。

请注意,我删除了 colspan,因为它在这里使用似乎非常不合适。

此外,您可能会问自己,为什么仍然要有外表标签。它并没有为您做任何无法以更好的方式完成的事情。

关于html - 表格对齐问题html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5958405/

相关文章:

html - 在 HTML 页面中嵌入本地 PDF

javascript - 点击切换开关

html - Angular Material md-button 不工作

html - 需要帮助为页脚应用悬停效果

php - 使用html php POST选中和未选中的复选框

html - 如何让标签在表 "cell"(td) 中右对齐?

javascript - 单击图像内部时播放音频文件,单击图像外部时播放不同的音频文件

html - 字体粗细不适用于任何浏览器

css - 父级不能水平居中div

具有复杂结构的 HTML 表格