[英]Table row (tr) separation and border
I have a styling issue with tables. 我有表格的样式问题。
I need the following: 我需要以下内容:
Something like this: 像这样的东西:
image: 图片:
for reference check this fiddle: http://jsfiddle.net/m15rccmr/ 供参考检查这个小提琴: http : //jsfiddle.net/m15rccmr/
table{ width: 100%; border-collapse: separate; border-spacing: 0 30px; } tr{ border-bottom: 1px solid red; } .mobile-fold{ display:block; } @media (min-width: 800px){ .mobile-fold{ display:table-cell; } }
<table> <tbody> <tr> <td>first</td> <td class="mobile-fold">second</td> <td class="mobile-fold">third</td> </tr> <tr> <td>first</td> <td class="mobile-fold">second</td> <td class="mobile-fold">third</td> </tr> <tr> <td>first</td> <td class="mobile-fold">second</td> <td class="mobile-fold">third</td> </tr> </tbody> </table>
I need to add a border between the table rows, and it should display fine on mobile and desktop. 我需要在表格行之间添加一个边框,它应该在移动设备和桌面上显示正常。
Any ideas? 有任何想法吗?
I think this is what you are after 我想这就是你所追求的
table { width: 100%; border-collapse: separate; border-spacing: 0 30px; } td { border-bottom: 1px solid red; } td:nth-of-type(2) { border: none; } .mobile-fold { display: block; } @media (min-width: 800px) { .mobile-fold { display: table-cell; } td:nth-of-type(2) { border-bottom: 1px solid red; } }
<table> <tbody> <tr> <td>first</td> <td class="mobile-fold">second</td> <td class="mobile-fold">third</td> </tr> <tr> <td>first</td> <td class="mobile-fold">second</td> <td class="mobile-fold">third</td> </tr> <tr> <td>first</td> <td class="mobile-fold">second</td> <td class="mobile-fold">third</td> </tr> </tbody> </table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.