2017-09-03 57 views
0

嗨我有一个数据表显示10列,但问题是它不适合屏幕正确。我仍然需要水平和垂直滚动查看其他列/行。我想要做的是让桌子变小。我怎样才能做到这一点?请参阅屏幕截图herehere。我试图设置表宽=“100%”,但不幸的是没有任何反应。JS JQuery Bootstrap数据表调整大小

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 
    <div class="container"> 
 
\t \t <div class="row"> 
 
\t \t \t <div class="col-md-12"> 
 

 
\t \t \t \t <center><h1 class="page-header">TMTRO Iloilo <small>Violators Records</small> </h1></center> 
 

 
\t \t \t \t <div class="removeMessages"></div> 
 

 
\t \t \t \t <button class="btn btn-default pull pull-right" data-toggle="modal" data-target="#addMember" id="addMemberModalBtn"> 
 
\t \t \t \t \t <span class="glyphicon glyphicon-plus-sign"></span> \t Add Member 
 
\t \t \t \t </button> 
 

 
\t \t \t \t <br /> <br /> <br /> 
 

 
\t \t \t \t <table class="table-striped table-bordered nowrap" width="100%" id="manageMemberTable"> \t \t \t \t \t 
 
\t \t \t \t \t <thead> 
 
\t \t \t \t \t \t <tr> 
 
\t \t \t \t \t \t \t <th>ID #</th> 
 
\t \t \t \t \t \t \t <th>Name</th> 
 
\t \t \t \t \t \t \t <th>Last Name</th> 
 
\t \t \t \t \t \t \t <th>License Number</th> 
 
\t \t \t \t \t \t \t <th>Violation</th> 
 
\t \t \t \t \t \t \t <th>Arrest Place</th> \t \t \t \t \t \t \t \t \t \t \t \t 
 
\t \t \t \t \t \t \t <th>Address</th> 
 
\t \t \t \t \t \t \t <th>Plate Number</th> 
 
\t \t \t \t \t \t \t <th>Contact Number</th> 
 
\t \t \t \t \t \t \t <th>Officer Name</th> 
 
\t \t \t \t \t \t \t <th>Date&Time</th> \t \t \t \t \t \t \t 
 
\t \t \t \t \t \t \t <th>Paid</th> 
 
\t \t \t \t \t \t \t <th>Option</th> 
 
\t \t \t \t \t \t </tr> 
 
\t \t \t \t \t </thead> 
 
\t \t \t \t </table> 
 
\t \t \t </div> 
 
\t \t </div> 
 
\t </div>

+0

这是使用HTML''

的非常不利的表格元素有这种怪异的'细胞分钟,width'功能,当谈到这一点细胞从调整迫使表走出去的停止其视图。为了使表格适合您所需的宽度,请使“文字较小”或删除不需要的列。 – masterpreenz

回答

0

HTML spec,一个<table>和其子自动调整大小。简单地说,默认情况下,窗口会抛出其他规则以使表本身看起来很好。

Bootstrap对此有一个答案,responsive tables。只需将table-responsive类添加到您的表格元素中,它将处理表格中的所有滚动条,而不是让整个页面滚动。

<table class="table table-responsive"> 
    ... 
</table>