ImTalkingCode
ImTalkingCode

Reputation: 385

Bootstrap - Horizontal Scrollbar appears on long dropdown-menu item

When I code-up a Bootstrap dropdown-menu and a menu-item is long, it creates a horizontal scrollbar which is annoying to users.

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.

Upvotes: 3

Views: 887

Answers (2)

ImTalkingCode
ImTalkingCode

Reputation: 385

I've decided to use dropdown-menu-right to align the menu items from the right which fixes the problem.

Upvotes: 1

sam
sam

Reputation: 28

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

Upvotes: 0

Related Questions