【发布时间】:2020-03-23 18:29:46
【问题描述】:
我一直在尝试使用我为圆桌角找到的 Stack Ooverflow 答案:
/*
table {
border-collapse: collapse;
}*/
table, tr, td, th{
border: 1px solid;
text-align: center;
/*padding: 10px;*/
}
table{
border-spacing: 0;
width: 100%;
display: table;
}
table tr:last-child td:first-child, tr:last-child, table {
border-bottom-left-radius: 25px;
}
table tr:last-child td:last-child, tr:last-child, table {
border-bottom-right-radius: 25px;
}
table tr:first-child th:first-child, tr:first-child, table {
border-top-left-radius: 25px;
}
table tr:first-child th:last-child, tr:first-child, table {
border-top-right-radius: 25px;
}
<table>
<tr>
<th>Num</th><th>Lett</th><th>Lat</th>
</tr>
<tr>
<td>1</td><td>A</td><td>I</td>
</tr>
<tr>
<td>2</td><td>B</td><td>II</td>
</tr>
<tr>
<td>3</td><td>C</td><td>III</td>
</tr>
</table>
这很好用。但如果我取消注释 border-collapse,则舍入消失。如果我取消注释padding: 10px,它会使边框加倍:
我需要border-collapse 来避免粗体内部边框。我需要padding 以便表格单元格中的文本与其边界有距离。如何在具有圆形外边框的同时实现它?
JSFiddle:https://jsfiddle.net/eszuhvxj/1/
【问题讨论】:
标签: html css html-table