.container{
height:300px;
overflow-y: scroll;
}
.container{
height:300px;
overflow-y: auto;
}
或是
.container{
max-height:300px;
overflow-y: scroll;
}
问题:
即使内容不超过高度,也会出现右边的滚动条(max-height与height出现的滚动条长短不一样,渲染数据有时多有时少,使用max-height)。
解决办法:
.container{
max-height:300px;
overflow-y: auto;
}