
我有这样的设置,结果包含在span标签中,并使用jquery"移动"到其他div中.目前搜索只返回30个最大值,这一切都很好,但我觉得这不是一个公平的限制.我希望能够做的是当结果多于可以显示的结果时滚动div,如列表框.我尝试了许多不同的方法,但似乎没有一种方法能够很好地工作.我希望它能保持一个固定的高度
Mr.*_*ien 25
你没有在这里分享任何标记,但如果你愿意拥有一个固定的高度,只需使用它
.container {
/* Optional - You can set a min-height : whatever px; for reserving some space*/
height: 200px; /* Fix a height here */
overflow: auto; /* Optionally you can also use overflow: scroll; */
}
Run Code Online (Sandbox Code Playgroud)
除了 @mr-alien 答案:您可以用来max-height限制容器的大小,同时使其适合内容:
.container {
/* Optional - You can set a min-height : whatever px; for reserving some space*/
max-height: 200px; /* Fix a max-height here */
overflow: auto; /* Optionally you can also use overflow: scroll; */
}
Run Code Online (Sandbox Code Playgroud)