[英]Css - Last Table Row Regardless of TD or TH
如何使用CSS选择器,它将始终捕获表的最后一行并将规则应用于最后的除法,无论它是TD还是TH,但不更改表中的最后TH。
我当前的规则仅适用于TD,并且我发现使TH变圆的所有方法,即使其中有更多TD也将变圆。
.tabGeral tr:first-child th:first-child {
border-top-left-radius:14px;
}
.tabGeral tr:first-child th:last-child {
border-top-right-radius:14px;
}
.tabGeral tr:last-child td:last-child {
border-bottom-right-radius:14px;
}
.tabGeral tr:last-child td:first-child{
border-bottom-left-radius:14px;
}
前两个是期望的结果,下两个是我要实现的结果
JSFiddle: https ://jsfiddle.net/rd48cfw8/3/
两个深绿色是TH,浅绿色是TD,由于表排序器,我需要它们分别为TH和TD。
如果仅使用tr:last-child td:first-child
,则第二个表将无法实现;如果仅使用tr:last-child th:first-child
,则第二个表将无法实现;如果使用a两者的结合,我得到了第四张桌子,不是很理想。
获得倒数第二个表格行
tr:nth-last-child(2) {}
然后,您可以将样式td
与
首先从后方选择
tr:nth-last-child(1) {}
将是最后一个孩子,依此类推。
您可以这样在倒数第二个tr
设置td
样式
tr:nth-last-child(2) td {
(whatever styling you want.)
}
更新:
这是我修复的小提琴:
.tabGeral:last-child tr:last-child th {
-webkit-border-bottom-right-radius: 9px;
-webkit-border-bottom-left-radius: 9px;
-moz-border-radius-bottomright: 9px;
-moz-border-radius-bottomleft: 9px;
border-bottom-right-radius: 9px;
border-bottom-left-radius: 9px;
}
为什么不使用隐藏在桌子上的溢流来切断边界半径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.