Help us understand the problem. What is going on with this article?

CSSでTable Cellに余白を作る方法

はじめに

bootstrapで実装していたTable Cellに余白を作る際に少しハマったのでメモです。

HTMLとCSS

bootstrap Examplesより

HTML

<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>

CSS

th,
td {
    border-right: 1px solid #104A9E !important;
    color: #104A9E;
}

スクリーンショット 2019-09-14 16.39.31.png

変更点(CSS)

CSSで背景色と同じborderを追加して余白があるように見えるように変更。

th,
td {
    border-right: 1px solid #104A9E !important;
    color: #104A9E;
}
/* 追加 */
tr {
    border-bottom: 10px solid #e9f1f9;
}

スクリーンショット 2019-09-14 16.41.44.png

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away