css td保证金崩溃

时间:2018-02-21 22:11:44

标签: javascript html css html-table

我有一个包含1行3个单元格的表, 当增加页面大小“Ctrl +”时,第二个单元格的内容在第二行上展开,并使第一个单元格的颜色不填充整个第一个单元格。按钮也会发生同样的事情,因为我修改它的高度会让其他细胞失去控制!不知何故,颜色不会伸展。我怎样才能解决这个问题?这似乎是某种边缘崩溃的问题。

 <table>
    <tr>
    <td style="background-color:yellow">
     <span> hello world how are you {{ name }}</span>
    </td>
    <td>  
<span> I am a very long paragraph which will break on a second line when i increase the size of my browser page and i will cause the first cell color to not stretch and fill the entire cell.. iam a mad man! hehe</span>
    </td>
<td>
    <button> </button>
    </td>
    </tr>
    </table>

1 个答案:

答案 0 :(得分:0)

您的第二个span不在HTML格式无效的表格单元格内。如果你把它放在第二个单元格内,一切都按预期运行:

&#13;
&#13;
button {
height: 200px;
}
&#13;
<table>
  <tr>
    <td style="background-color:yellow">
      <span> hello world how are you {{ name }}</span>
    </td>
    <td>
    <span> I am a very long paragraph which will break on a second line when i increase the size of my browser page and i will cause the first cell color to not stretch and fill the entire cell.. iam a mad man! hehe</span>
    </td>
    <td>
      <button>The button</button>
    </td>
  </tr>
</table>
&#13;
&#13;
&#13;