我必须创建一个类似 IRC 的网络聊天(最新消息必须出现在父容器的底部)。
这是我的(不成功的)尝试:
.inner-conversation-container {
height: 100px;
position: relative;
overflow: hidden;
width: 500px;
}
.conversation-stream-container {
max-height: 100px;
position: absolute;
bottom: 0;
overflow: auto;
width: 100%;
}
<div class='inner-conversation-container'>
<div class='conversation-stream-container'>
<div class='conversation-item'>
<div class='conversation-message-part' msg-id='137'>
<div class='center-part'>Content</div>
</div>
<div class='conversation-message-part' msg-id='138'>
<div class='center-part'>Content</div>
</div>
<div class='conversation-message-part' msg-id='139'>
<div class='center-part'>Content</div>
</div>
<div class='conversation-message-part' msg-id='140'>
<div class='center-part'>Content</div>
</div>
<div class='conversation-message-part' msg-id='141'>
<div class='center-part'>Content</div>
</div>
<div class='conversation-message-part' msg-id='142'>
<div class='center-part'>Content</div>
</div>
<div class='conversation-message-part' msg-id='143'>
<div class='center-part'>Content</div>
</div>
<div class='conversation-message-part' msg-id='144'>
<div class='center-part'>The latest message that needs to be in the bottom</div>
</div>
</div>
</div>
</div>
div
withmsg-id="144"
需要可见并与底部对齐。