简体   繁体   English

HTML,CSS,表格行上的双边框

[英]Html,css: double border on table's rows

I am trying to "copy" http://grooveshark.com/#!/album/Halo+LP/5904939 this table right here. 我正在尝试在此处“复制”此表http://grooveshark.com/#!/album/Halo+LP/5904939
This is my attempt http://jsfiddle.net/d1zqsayh/25/ 这是我的尝试http://jsfiddle.net/d1zqsayh/25/
Problem with my code is that somehow, when you hover over <tr> s and the bottom border is double (2px up from 1) 我的代码存在的问题是,当您将鼠标悬停在<tr>并且底部边框是double时(从1向上2px),
I tried adding border-collapse: collapse; 我尝试添加border-collapse: collapse; in my code and didn't fix it as a stack overflow post suggested. 在我的代码中,并没有解决它,因为建议使用堆栈溢出帖子。
Maybe i am doing it wrong. 也许我做错了。
Can someone try and make this work ? 有人可以尝试做这个工作吗?
I have put all the important .css rows on the top 63 lines. 我把所有重要的.css行都放在了前63行。

Note: I am using DataTables 注意:我正在使用DataTables

Grooveshark does not use a table layout, they have a <div> for each row with -1px top margin, so on hover it will overlap the row above. Grooveshark不使用表格布局,它们的每一行都有一个<div>-1px上边距为-1px ,因此悬停时它将与上面的行重叠。

You can use however the element+element adjacent sibling selector to achieve the same thing. 但是,您可以使用element+element 相邻兄弟选择器来实现相同的目的。 First, only use top borders and on hover, with the element+element selector, change the border color of the next row: 首先,仅使用顶部边框,将其悬停时,使用element + element选择器更改下一行的边框颜色:

table.dataTable tbody tr td{
  border-top: 1px solid #dddddd;
}

table.dataTable tbody tr:hover td {
    border-top: 1px solid rgb(192, 220, 255);
}

table.dataTable tbody tr:hover + tr td {
    border-top: 1px solid rgb(192, 220, 255);
}

Example: http://jsfiddle.net/d1zqsayh/26/ 示例: http//jsfiddle.net/d1zqsayh/26/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM