css 如何在Bootstrap中使表的所有td部分的边框大小相同

jqjz2hbq  于 2022-12-01  发布在  Bootstrap
关注(0)|答案(1)|浏览(150)
  • I was trying to set border for td. However, the border size looks disimilar. How to apply similar border size to all td sections?*

You can see the image reference here:

Here is my Css part:

.table td{
             border: 1px solid green !important;
                }
                
   .table{
           border-collapse:collapse !important;
                }
cngwdvgl

cngwdvgl1#

尝试使用Bootstrap中的.table-bordered类,而不是在CSS中设置手动边框。您也可以使用.border-success来设置绿色。
Tables · Bootstrap v5.0

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

<table class="table table-bordered border-success">
  <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>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

相关问题