php - 有没有办法限制下拉框的大小

标签 php html css twitter-bootstrap

我正在使用 bootstrap 来构建我的网站,我使用的下拉列表对于页面来说太长了,所以有些元素看不到,有什么办法可以限制它在需要用户滚动之前可以达到的长度,我附上了一张图片来展示我的意思以及我目前正在使用的代码 Image showing the dropdown issue

<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 and overflow 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/

相关文章:

php - codeigniter:将数组从 Controller 传递到 View

html - 扩展线性渐变背景不受div布局影响

PHP 表列

javascript - 将悬停转换为 jquery 的单击事件

php - 通过 MySQL 生成的下拉列表预览 MySQL 中的数据

php - 在 woocommerce 中添加内容和自定义页面标题的位置

javascript - 如何将焦点设置在包含其他标签的可编辑 div 元素区域的末尾

css - 将多个 CSS 文件合并为一个

css - border-box + padding + max-width = 跳跃元素?

php - 如何在shell脚本中无限次运行php文件