【发布时间】:2020-02-21 17:46:49
【问题描述】:
如何使用 css 对 html 表格进行圆角?
表格如下:
<table>
<tr>
<th colspan="2">header</th>
</tr>
<tr>
<td>data1</td>
<td>data2</td>
</tr>
</table>
CSS:
th {
background-color: black;
color: white;
border: none;
}
table {
border-collapse: collapse;
border: 1px solid;
border-radius: 5px;
}
table tr:first-child th:first-child {
border-top-left-radius: 5px
}
table tr:first-child th:last-child {
border-top-right-radius: 5px
}
table tr:last-child td:first-child {
border-bottom-left-radius: 5px
}
table tr:last-child td:last-child {
border-bottom-right-radius: 5px
}
只有右上角和左上角是圆角的,但它们上面有黑色边框,不是圆角。并且底角不是圆形的。 我希望所有这些角落都是圆的。
【问题讨论】: