细胞之间但不能从左,右表格边框的HTML表空间

问题描述 投票:0回答:2

在我的HTML我有边框间距设置表为2px。是否有可能去除的第一列和我的桌子的左边框之间的空间?当然,这样做的最后一个单元格和表格的右边框?这是我的HTML和CSS

table{
    table-layout: fixed ;
    width:100%;
    min-width:1024px;
    padding:0px;
    margin:0px;
    border-spacing:2px; 
}
<table>
 <tr>
  <td style='background-color:#f63; border-left:none;'>
   cell1
  </td>
  <td style='background-color:#f93;'>
   cell2
  </td>
  <td style='background-color:#f33; border-right:none;'>
   cell3
  </td>
 </tr>
</table>
html css html-table border-spacing
2个回答
0
投票

首先,你应该在你的样式表的顶部添加以下删除间距:

* {
    margin: 0;
    padding: 0;
}

然后加入width: 100%;表选择器,这会分散你的栏目,所以这里就空白留在边界。


0
投票

卢卡斯是正确的。

/* This will remove all spacings from your page */

* {
  margin: 0;
  padding: 0;
}
© www.soinside.com 2019 - 2024. All rights reserved.