【发布时间】:2021-01-11 01:21:54
【问题描述】:
我正在尝试制作一个像 facebook messenger 这样的聊天框。我正在使用最大高度和溢出,但是当聊天区域溢出时滚动条会自动滚动到顶部。 div溢出时如何保持滚动条在bot上的位置?
HTML
<div class="chatarea-cover">
<div class="chatarea"></div>//chat messages will be pushed to here
</div>
CSS
.chatarea-cover {
max-height: 200px;
overflow-y: scroll;
}
.chatarea {
padding-right: 10px;
width: 300px;
height: 200px;
display: table-cell;
vertical-align: bottom;
}
【问题讨论】:
标签: javascript html css