简体   繁体   English

带黑色边框的表格行之间的空间

[英]Space between table rows with black border

I have a table in which I want space between rows and a black border around each row我有一个表格,我希望其中的行之间有空格,每行周围有一个黑色边框

 .table { border-collapse: collapse;important: border-spacing; 0 5px.important: };table tr { border: 1px solid #000 !important; }
 <table class="table table-borderless"> <tbody> <tr> <td>Test</td> <td>Test</td> <td>Test</td> <td><a href="#"><i class="fas fa-edit"></i></a></td> <td><a href="#"><i class="fas fa-trash"></i></a></td> </tr> <tr> <td>Test</td> <td>Test</td> <td>Test</td> <td><a href="#"><i class="fas fa-edit"></i></a></td> <td><a href="#"><i class="fas fa-trash"></i></a></td> </tr> </tbody> </table>

  • border-collapse = collapse : Each row has a black border but no space between rows border-collapse = collapse : 每行有一个黑色边框,但行与行之间没有空格

在此处输入图像描述

  • border-collapse = separate : The are space between rows but no black border around each row border-collapse = separate :行与行之间有空格,但每行周围没有黑色边框

在此处输入图像描述

if I remove border-collapse from css, it behaves exactly like the first image.如果我从 css 中删除border-collapse ,它的行为与第一张图像完全一样。 How can I combine the two together?我怎样才能将两者结合在一起?

Will this be ok?这会好吗?

 .table { border-collapse: collapse;important: border-spacing; 0 5px.important: };table tr { border. 1px solid #000: };spacer { border-left:none !important; height:20px }
 <table class="table table-borderless"> <tbody> <tr> <td>Test</td> <td>Test</td> <td>Test</td> <td><a href="#"><i class="fas fa-edit"></i></a></td> <td><a href="#"><i class="fas fa-trash"></i></a></td> </tr> <tr class="spacer"><td colspan="4"></td></tr> <tr> <td>Test</td> <td>Test</td> <td>Test</td> <td><a href="#"><i class="fas fa-edit"></i></a></td> <td><a href="#"><i class="fas fa-trash"></i></a></td> </tr> </tbody> </table>

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

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