Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two Side-by-Side Tables in Bootstrap

Tags:

Is it possible to display two tables, side-by-side, in Bootstrap 3?

Each tried making each one col-md-6 and, although it shrinks the width, they don't wrap next to each other (instead one is on top of the other in the full-width view).

 <div class="table-responsive">             <table class="table table-striped">               <thead>                 <tr>                   <th class="col-md-1">#</th>                   <th class="col-md-2">Header</th>                   <th class="col-md-3">Header</th>                 </tr>               </thead>               <tbody>                 <tr>                   <td class="col-md-1">1,001</td>                   <td class="col-md-2">1,001</td>                   <td class="col-md-3">1,001</td>                 </tr>                 <tr>                   <td class="col-md-1">1,001</td>                   <td class="col-md-2">1,001</td>                   <td class="col-md-3">1,001</td>                 </tr>                  <tr>                   <td class="col-md-1">1,001</td>                   <td class="col-md-2">1,001</td>                   <td class="col-md-3">1,001</td>                 </tr>               </tbody>             </table>           </div>           <h2 class="sub-header">Latest Incidents</h2>           <div class="table-responsive">             <table class="table table-striped">               <thead>                 <tr>                   <th class="col-md-1">#</th>                   <th class="col-md-2">Header</th>                   <th class="col-md-3">Header</th>                 </tr>               </thead>               <tbody>                 <tr>                   <td class="col-md-1">1,001</td>                   <td class="col-md-2">1,001</td>                   <td class="col-md-3">1,001</td>                 </tr>                 <tr>                   <td class="col-md-1">1,001</td>                   <td class="col-md-2">1,001</td>                   <td class="col-md-3">1,001</td>                 </tr>                  <tr>                   <td class="col-md-1">1,001</td>                   <td class="col-md-2">1,001</td>                   <td class="col-md-3">1,001</td>                 </tr>               </tbody>             </table> 
like image 833
okoboko Avatar asked Jun 01 '14 06:06

okoboko


People also ask

How do I view two tables side by side in SQL?

SQL joins allow you to combine two datasets side-by-side, but UNION allows you to stack one dataset on top of the other. Put differently, UNION allows you to write two separate SELECT statements, and to have the results of one statement display in the same table as the results from the other statement.

What is table striped?

.table-striped. Adds zebra-striping to any table row within <tbody> (not available in IE8) Try it. .table-bordered. Adds border on all sides of the table and cells.


1 Answers

You need to wrap each table in a col-6 div, as opposed to applying col-6 to the table itself. Here is your code with col-xs-6 wrapped around:

<div class="col-xs-6">   <h2 class="sub-header">Subtitle</h2>   <div class="table-responsive">     <table class="table table-striped">... 

And here it is in action: http://www.bootply.com/lbrQZF3152

like image 186
Shawn Taylor Avatar answered Nov 17 '22 10:11

Shawn Taylor