html - 控制选择元素中显示的选项数量
所以我有一个下拉(选择)元素。问题是,如果其中有一个长列表,那么它会向上而不是向下“下降”。
有没有办法说它应该滚动而不是一次显示所有内容?
我知道有“大小”,但这就是一次可见的数量(我只想要一个可见,就像正常情况一样)
或者是因为它包含 div 而没有自动滚动条的原因?它是否需要知道它应该在哪里结束或者什么?
So I have a drop down (select) element. The problem is that if there is a long list in it, then it "drops" upwards instead of downwards.
Is there a way to say that it should scroll rather than show all of them at once?
I know there's "size" but that's how many are visible at once (I only want one visible, like normal)
Or is the reason it's not having a scrollbar automatically caused by it's containing div? Does it need to know where it should end or something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
其工作方式取决于浏览器。除了使用 JS 构建自己的下拉菜单之外,您对此无能为力。
The way this works is up to the browser. Nothing you can do about it, other than building your own drop-down with JS.
问题不在于列表大小,它根据上方或下方的大小向上或向下下降,以便在可能的情况下始终显示整个列表。这是一种综合行为,我认为(而且我不想)你可以改变它。
The problem is not the list size, it drops upwards or downwards according the size above or below to always show the entire list if possible. It's a comprehensive behaviour and I don't think (and I don't want) you can change it.