Bootstrap 3表溢出面板

时间:2014-04-10 04:59:41

标签: twitter-bootstrap twitter-bootstrap-3 html-table

我在面板内部使用bootstrap表,如果包含长信息,则在面板外溢出,如何解决?

enter image description here

<div class="col-sm-3" role="complementary">

<div class="panel panel-default">
    <div class="panel-body table-responsive">
    <table class="table table-bordered table-condensed f11">
        <tr>
            <td colspan="2" align="center" class="info"><b>Info</b></td>
        </tr>
        <tr>
            <td width="35%"><b>Agent</b></td>
            <td width="65%">Luckystar Auto</td>
        </tr>
        <tr>
            <td><b>WhatsApp</b></td>
            <td>5412876542</td>
        </tr>
        <tr>
            <td><b>WeChat</b></td>
            <td>Luckystar88899</td>
        </tr>
        <tr>
            <td><b>Facebook</b></td>
            <td>www.facebook.com/luckystar88899-abcd</td>
        </tr>
    </table>
    </div>
</div>

<div class="panel panel-default">
    <div class="panel-body">


      <p><div id="map-canvas"></div></p>
    </div>
</div>

1 个答案:

答案 0 :(得分:24)

由于网址链接太宽,会发生这种情况。

解决方法是使用CSS省略号根据需要截断单元格内容:

.table {
    table-layout:fixed;
}

.table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

}

演示:http://bootply.com/128979