2
回答
bootstrap中下拉菜单中如果有很多项的话怎么让下拉菜单出现滚动条而不是整个页面出现滚动条?

如果,怎么让下拉列表出现滚动框而不是页面滚动呢?

代码如下:

<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
 <link href="css/index.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
  <div class="container">
    <div class="row">
   <div class="col-xs-4">
  <div class="dropdown text-center">
    <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true" style="border:none;">
   类别
   <span class="caret"></span>
    </button>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别1</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别2</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别3</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别4</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别1</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别2</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别3</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别4</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别1</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别2</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别3</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别4</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别1</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别2</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别3</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别4</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别1</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别2</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别3</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别4</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别1</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别2</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别3</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别4</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别1</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别2</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别3</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别4</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别1</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别2</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别3</a></li>
   <li role="presentation"><a role="menuitem" tabindex="-1" href="#">类别4</a></li>
    </ul>
  </div>
   </div>
 </div>
<!------------------------------------------------->


 <div class="row">
  <div class="col-xs-12">
   <button type="button" class="btn btn-default" style="width:100%;border:none;">加载更多...</button>
  </div>
 </div>
  </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

 

举报
133088515
发帖于4年前 2回/3K+阅
顶部