Html Css-不考虑TD或TH的最后一行表格
如何使用CSS选择器始终捕获表的最后一行并将规则应用于最后一个分区,而不管它是TD还是TH,但不改变表中的最后一个TH 我目前的规则只适用于TD,而我发现的所有进入第三轮的方法都是,即使有更多的TDs,它也会循环Html Css-不考虑TD或TH的最后一行表格,html,css,Html,Css,如何使用CSS选择器始终捕获表的最后一行并将规则应用于最后一个分区,而不管它是TD还是TH,但不改变表中的最后一个TH 我目前的规则只适用于TD,而我发现的所有进入第三轮的方法都是,即使有更多的TDs,它也会循环 .tabGeral tr:first-child th:first-child { border-top-left-radius:14px; } .tabGeral tr:first-child th:last-child { border-top-right-ra
.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:
两个深绿色是TH,浅色绿色是TD,我需要它们是TH和TD,因为桌面分拣机
如果我只使用
tr:last child td:first child
,则无法获得第二个表;如果我只使用tr:last child th:first child
,则无法获得第一个表;如果我同时使用这两个表,则会得到第四个表,这是不需要的。要获得将要使用的最后第二个表行
tr:nth-last-child(2) {}
然后,您可以使用
这将首先从后面进行选择
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;
}
为什么不在您的表格上使用隐藏的溢出,这样它会切断边框半径如果您为我们提供一个带有HTML和CSS的Fiddle/CodePen/CodeSnippet,将更容易帮助您。@DineiA.Rockenbach OT:您使用的表格元素不正确。看起来,
用于样式设计,它们的用途不同。如果有效,请勾选答案。谢谢。用你的小提琴更新了。