我正在使用 bootstrap 来构建我的网站,我使用的下拉列表对于页面来说太长了,所以有些元素看不到,有什么办法可以限制它在需要用户滚动之前可以达到的长度,我附上了一张图片来展示我的意思以及我目前正在使用的代码
<ul class="dropdown-menu">
<li role="separator" class="divider"></li>
<li><a href="../category.php">Search By Category:</a></li>
<li role="separator" class="divider"></li>
<?php echo $htmlResult1; ?>
</ul>
主要结果是通过 php 引入的,但要按照正确的样式列出
任何想法
最佳答案
作为@Luis P.A.说:
Set a
max-height
andoverflow
to<ul>
ul.dropdown-menu {
max-height: 400px;
overflow-y: auto; /*scroll results in a scrollbar even when the height < 400px */
}
关于php - 有没有办法限制下拉框的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33873786/