Search code examples
csshtmlbootstrap-modal

Bootstrap table with borders only on the inside


I wish to create a table with Bootstrap but the table must have borders only on the inside. Have some ideas? If it is possible I don't wish to use css but only html and Bootstrap. Thank you.

At the end I wish to implement this: Table


Solution

  • It's very cumbersome, but this is the best I got using Bootstrap's border utility classes https://getbootstrap.com/docs/4.1/utilities/borders/

    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
      <title>Overlay</title>
    </head>
    <body>
      <div class="container">
      <table class="table" style="margin-top: 10px;">
      <thead>
        <tr>
          <th scope="col" class="border-top-0 border-right border-bottom-0">#</th>
          <th scope="col" class="border-top-0 border-right border-bottom-0">First</th>
          <th scope="col" class="border-top-0 border-right border-bottom-0">Last</th>
          <th scope="col" class="border-top-0 border-right border-bottom-0 border-right-0">Handle</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td scope="row" class="border-right border-bottom-0">1</td>
          <td class="border-right border-bottom-0"> Mark</td>
          <td class="border-right border-bottom-0">Otto</td>
          <td class="border-right border-bottom-0 border-right-0">@mdo</td>
        </tr>
        <tr>
          <td scope="row" class="border-right border-bottom-0">1</td>
          <td class="border-right border-bottom-0"> Mark</td>
          <td class="border-right border-bottom-0">Otto</td>
          <td class="border-right border-bottom-0 border-right-0">@mdo</td>
        </tr>
        <tr>
          <td scope="row" class="border-right border-bottom-0">1</td>
          <td class="border-right border-bottom-0"> Mark</td>
          <td class="border-right border-bottom-0">Otto</td>
          <td class="border-right border-bottom-0 border-right-0">@mdo</td>
        </tr>
      </tbody>
    </table>
    </div>
    
    </body>

    See this fiddle