Bootstrap - 水平滚动条出现在长下拉菜单项上

时间:2017-03-07 03:06:35

标签: twitter-bootstrap

当我编写一个Bootstrap下拉菜单并且菜单项很长时,它会创建一个让用户烦恼的水平滚动条。

HTML:

<br/><br/>

<div class="container">
<div class="row">

  <div class="col-md-12">

     <div class="panel panel-default">
        <div class="panel-heading">
          Main Heading
        </div>
        <div class="panel-body">
           <div class="table-responsive">
             <table class="table">
             <thead>
               <th>Big</th>
               <th>Small</th>
             </thead>
             <tbody>
               <tr>
               <td style="width:95%">
                 &nbsp;
               </td>
               <td>
               <div class="btn-group">
                 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                   <span data-bind="label">Select One</span>&nbsp;<span class="caret"></span>
                 </button>
                 <ul class="dropdown-menu" role="menu">
                   <li><a href="#">Item 1</a></li>
                   <li><a href="#">Another item</a></li>
                   <li><a href="#">This is a longer item that will not fit properly</a></li>
                 </ul>
               </div>
               </td>
               </tr>
               </tbody>
             </table>
           </div>
         </div>
      </div>

  </div>



JsFiddle:http://jsfiddle.net/ImTalkingCode/j84qfvsj/11/

THX。

2 个答案:

答案 0 :(得分:0)

try div class="table-responsive" style="overflow-x:hidden;"

答案 1 :(得分:0)

我决定使用下拉菜单右键来调整右边的菜单项来解决问题。