答案 0 :(得分:0)
为tr
元素添加边框有点问题。您应该将样式定位到里面的td
元素。
JSFiddle:https://jsfiddle.net/72pg7xry/
table {
border-spacing: 0;
}
tr.blue td {
border-top: 5px solid blue;
border-bottom: 5px solid blue;
}
tr.blue td:first-child {
border-left: 5px solid blue;
}
tr.blue td:last-child {
border-right: 5px solid blue;
}
tr.green td {
border-top: 5px solid green;
border-bottom: 5px solid green;
}
tr.green td:first-child {
border-left: 5px solid green;
}
tr.green td:last-child {
border-right: 5px solid green;
}
以下有关为什么样式tr
很棘手的更多信息:Add border-bottom to table row <tr>