Bootstrap,如何使两个表格相同“宽度”

时间:2015-05-25 17:16:25

标签: html css twitter-bootstrap html-table

我有两张桌子:

tables

我希望它们具有相同的宽度,我不知道它的名称是什么,但你可以看到列的宽度不同。

这是我的代码:

    <aside>
    <table class="table table-bordered" style="margin: 0;">
        <thead>
        <tr></tr>
        <tr></tr>
        </thead>
        <tbody>
        <tr>
            <td class="tableHeader">Pilot ID</td>
            <td><?php echo 'SAS ' . $results['id'];?></td>
        </tr>
        <tr>
            <td class="tableHeader">First Name</td>
            <td><?php echo $results['firstname'];?></td>
        </tr>
        <tr>
            <td class="tableHeader">Last Name</td>
            <td><?php echo $results['lastname'];?></td>
        </tr>
        <tr>
            <td class="tableHeader">Age</td>
            <td>17</td>
        </tr>
        <tr>
            <td class="tableHeader">Distance Flown</td>
            <td>3790 km</td>
        </tr>
        <tr>
            <td class="tableHeader">Flights</td>
            <td><?php echo $results['flights'];?></td>
        </tr>
        <tr>
            <td class="tableHeader">Flight Hours</td>
            <td><?php echo $results['flighttime'];?></td>
        </tr>
        </tbody>
    </table>
    <table class="table table-bordered style="margin: 0;"">
    <thead>
    <tr></tr>
    <tr></tr>
    </thead>
    <tbody>
    <tr>
        <td class="tableHeader">737-600</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">737-700</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">737-800</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">A319</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">A320</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">A321</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">A330</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">A340</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">CRJ-900</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">ATR-600</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">717</td>
        <td></td>
    </tr>
    <tr>
        <td class="tableHeader">SAB 2000</td>
        <td></td>
    </tr>
    </tbody>
    </table>
</aside>

JSFIDDLE:https://jsfiddle.net/ncqmy09c/

3 个答案:

答案 0 :(得分:7)

你可以做到。

.table {
    table-layout: fixed;
}

http://jsfiddle.net/vawtr0u5/

答案 1 :(得分:1)

1)div.row。

2)div.col-xs-6 * 2.

3)你的表......

像这样 - &gt; Example jsfiddle

<div class="row">
    <div class="col-xs-6">
        <table class="table table-bordered" style="margin: 0;">
            TABLE 1
        </table>
    </div>
    <div class="col-xs-6">
        <table class="table table-bordered" style="margin: 0;">
            TABLE 2
        </table>        

    </div>
</div>

答案 2 :(得分:0)

您还可以使用HTML col width Attribute

Meteor.subscribe("streams");

Template.body.helpers({
  streams: function(){
    return Streams.find();
  }
});

小提琴:https://jsfiddle.net/ncqmy09c/1/