我如何确保下拉列表的列表始终下拉而不是向上 [英] how can I make sure a dropdownlist's list is always dropped down rather than up

查看:100
本文介绍了我如何确保下拉列表的列表始终下拉而不是向上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想始终显示下拉列表. (可以吗?)

I want to show dropdownlist always to down. (Is it posible?)

如果底部空间小于下拉列表的高度,则显示列表向上.

If bottom space is less then the height of dropdown list it's show list to up.

我想始终显示列表.

预先感谢

推荐答案

这可以通过将以下属性添加到下拉列表的CSS类中来实现:

This can be achieved by adding the following attribute to your CSS class of your dropdown list:

.drop-down {
    top:100%; 
}

可以使用相同的方法来强制列表向上移动:bottom: 100%;

The same can be used to force the list to go upwards: bottom: 100%;

这是 jsfiddle演示.

不能将标准HTML格式的选择选项(<select><option> <option></select>)扩展到特定方向.您必须使用JavaScript编写自己的自定义下拉菜单,才能实现此功能.

The standard HTML form Select Option (<select><option> <option></select>) can not be manipulated to expand into a certain direction. You'll have to write your own custom dropdown menu with JavaScript to implement this functionality.

快速浏览后,我发现其他人一直在为您遇到的问题而苦苦挣扎.显然,以下CSS代码在某些情况下似乎可以解决该问题.

After a quick browse I've noticed that others have struggled with the problem you're having. And apparently the following CSS code seems to fix it in some cases.

select { vertical-align: top; }

这篇关于我如何确保下拉列表的列表始终下拉而不是向上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆