如何使用CSS删除表格中相互重叠的边框

holgip5t  于 2023-08-09  发布在  其他
关注(0)|答案(1)|浏览(140)

我已经创建了表格,但在两个单元格相交的地方,边框较暗且较厚。我该如何解决此问题?这是我的CSS代码。

.custom-table-2 {
  border-collapse: separate;
  /*border-collapse: collapse;*/
  border-spacing: 0;
}

.custom-table-2 td {
  border: 1px solid #00953B;
}

.custom-table-2 tr:first-child td:first-child {
  border: 0px;
}

.custom-table-2 tr:nth-child(2) td:first-child {
  border-top-left-radius: 16px;
}

.custom-table-2 tr:first-child td:nth-child(2) {
  border-top-left-radius: 16px;
}

.custom-table-2 tr:first-child td:last-child {
  border-top-right-radius: 16px;
}
.custom-table-2 td:nth-child(2) {
  background-color: #7CCB99;
}

字符串
Image of the table
如果我使用'border-collapse:折叠;',它不会变厚,但边界半径不会显示。有什么解决办法吗?

dtcbnfnu

dtcbnfnu1#

<td>设置单独的边框,而不是速记:

table {
  border-collapse: separate;
  border-spacing: 0;
}

table td {
  border-left: 1px solid #00953B;
  border-top: 1px solid #00953B;
  padding: 20px;
}

table td:last-child {
  border-right: solid 1px #00953B;
}

table tr:last-child td {
  border-bottom: solid 1px #00953B;
}

table tr:first-child td:first-child {
  border: 0px;
}

table tr:nth-child(2) td:first-child {
  border-top-left-radius: 16px;
}

table tr:first-child td:nth-child(2) {
  border-top-left-radius: 16px;
}

table tr:first-child td:last-child {
  border-top-right-radius: 16px;
}

table td:nth-child(2) {
  background-color: #7CCB99;
}

个字符

相关问题