Amine Messaoudi
Amine Messaoudi

Reputation: 2279

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>

enter image description here

enter image description here

if I remove border-collapse from css, it behaves exactly like the first image. How can I combine the two together ?

Upvotes: 0

Views: 55

Answers (1)

mplungjan
mplungjan

Reputation: 177786

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>

Upvotes: 1

Related Questions