无法使用DataTables中的CSS修复行边框

时间:2019-08-08 17:03:33

标签: css datatables

我正在尝试在表格中特定行的底部添加深色边框。

我在行(opportunities = cwObj.get_opportunities() temp = [] opportunity_list = [] cw_presales_engineers = [] for opportunity in opportunities: temp.append(str(opportunity['id'])) opportunity_list = ','.join(temp) presales_tickets = cwObj.get_tickets_by_opportunity(opportunity_list) for presales_ticket in presales_tickets: try: if presales_ticket: try: cw_engineer = presales_ticket['owner']['name'] cw_presales_engineers.append(cw_engineer) except: pass else: cw_engineer = '' cw_presales_engineers.append(cw_engineer) except AttributeError: cw_engineer = '' )中添加了自定义类,并在CSS中添加了以下内容:

des-rec-row

在Chrome的开发工具中,class和css属性显示为活动状态,但边框不正确。我可以将鼠标悬停在该属性上,然后查看边界应该在哪里。

我也在https://jsfiddle.net/onLuw2pa/中复制了此内容。如果您在开发工具中将.des-rec-row { border-bottom: 1px solid #111; } 添加到任何行中,则不会发生任何事情。

这是特异性问题吗?是继承吗?是否发生重叠?我会承认CSS不是我的专长,有人可以帮我解决这个问题吗?

编辑----

使用无效的CSS更新了jsFiddle: https://jsfiddle.net/n3o78yL1/

1 个答案:

答案 0 :(得分:1)

您不能在tr上添加边框,但是可以将边框添加到其中的每个td上,并且外观相同。

编辑CSS并使其:

.even td {
  border-bottom: 1px solid red;
}

正在工作的小提琴:https://jsfiddle.net/c50tj8fr/