Bootstrap Tutorial - Split table border and header to panel body and panel header








The following code shows how to split table border and header to panel body and panel header.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-git2.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://getbootstrap.com/assets/css/docs.css">
<link rel="stylesheet" type="text/css"
  href="http://getbootstrap.com/dist/css/bootstrap.css">
<script type='text/javascript'
  src="http://requirejs.org/docs/release/2.1.8/minified/require.js"></script>
<style type='text/css'>
.panel-success>.panel-footer {
  color: #468847;
  background-color: #dff0d8;
  border-color: #d6e9c6;
}<!--  www.ja  v a  2  s. c o m-->
.panel-heading>.table, .panel-heading>.table th {
  margin: 0px;
  border: 0px;
}
</style>
</head>
<body style='margin:30px'>
  <div class="panel panel-primary">
    <div class="panel-heading">
      <table class="table table-condensed">
        <thead>
          <tr>
            <th>#</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Username</th>
          </tr>
        </thead>
      </table>
    </div>
    <div class="panel-body">
      <!--table-->
      <table class="table table-condensed">
        <tbody>
          <tr>
            <td>1</td>
            <td>Mark</td>
            <td>Otto</td>
            <td>@asdf</td>
          </tr>
          <tr>
            <td>2</td>
            <td>Jacob</td>
            <td>Jason</td>
            <td>@asdf</td>
          </tr>
          <tr>
            <td>3</td>
            <td colspan="2">Larry the Bird</td>
            <td>@twitter</td>
          </tr>
        </tbody>
      </table>
      <!--end of table-->
    </div>
  </div>
</body>
</html>

Click to view the demo