简体   繁体   English

拆分表行(间距)

[英]split table rows (spacing)

I am trying to implement a table in bootstrap.我正在尝试在引导程序中实现一个表。 The goal is to use a dark color as the background and a lighter color as the background of the table rows.目标是使用深色作为背景,使用浅色作为表格行的背景。 Is it possible to divide the table rows, giving a space between them?是否可以划分表格行,在它们之间留出空间?

The content will be populated using * ngFor,内容将使用 * ngFor 填充,

What I want我想要的是

图片

My code我的代码

Codeply代码

<table class="table table-borderless">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

There are many ways to create space.创造空间的方法有很多。 I provide some to give you a direction.我提供一些给你一个方向。

One is directly add border-bottom to your <tr>一种是直接将border-bottom 添加到您的<tr>

 tr { border-bottom: 10px solid grey; }

Another one is uniformly create border space for your table, but you have to set background and foreground color.另一种是为您的表格统一创建边框空间,但您必须设置背景和前景色。 It slightly different to what you want but you might want to try it out.它与您想要的略有不同,但您可能想尝试一下。

 table { border-collapse: separate; border-spacing: 0 10px; background-color:grey; } tr { background-color:white;}

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

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