我只想折叠外部边框,而不折叠剧院内部:
table, tr {
border: 1px solid black;
padding: 7px;
border-collapse: collapse;
}
th {
background: #ccccff;
}
<table>
<thead>
<tr>
<th>Data 1</th>
<th>Data 2</th>
</tr>
</thead>
</table>
不会显示出th
喜欢之间的边界Data 1 | Data 2
,为什么?(以及如何在th
元素之间添加这些边界)?
border: 1px solid black
从中删除table, tr
。并为右侧设置边框border-right: 1px solid black
。同样,使用:last-of-type
伪类,删除最后一个元素的边框。
table, tr {
/*border: 1px solid black;*/
padding: 7px;
border-collapse: collapse;
}
th {
background: #ccccff;
border-right: 1px solid black;
}
th:last-of-type {
border-right: unset;
}
<table>
<thead>
<tr>
<th>Data 1</th>
<th>Data 2</th>
<th>Data 3</th>
<th>Data 4</th>
<th>Data 5</th>
<th>Data 6</th>
<th>Data 7</th>
<th>Data 8</th>
<th>Data 9</th>
<th>Data 10</th>
</tr>
</thead>
</table>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句