我如何确保下拉列表的列表始终下拉而不是向上
我想始终显示下拉列表. (可以吗?)
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; }