I just cant figure out a solution for my problem. I have CSS file and HTML, I had to create ChatBot where all the styling is located in CSS.
I am trying to make the Scrollbar go down when all screen is filled with messages and show the newest one. Messages are starting from top and then filling down til bottom.
This is my html main body code a.k.a chat screen body. In textFields are the messages witch is placed there with Jquery from user input. And bot output.
.chatBox {
height: 80%;
padding: 25px;
overflow-y: auto;
}
.textFields {
--rad: 20px;
--rad-sm: 3px;
font: 16px/1.5 sans-serif;
max-width: 100%;
min-height: 90%;
padding: 20px;
display: flex;
flex-direction: column;
margin-bottom: 20px;
}
#msgBubble {
border-radius: var(--rad) var(--rad-sm) var(--rad-sm) var(--rad);
background: #42a5f5;
color: #fff;
margin-left: auto;
max-width: 250px;
max-height: 250px;
padding: 10px 10px;
word-break: break-word;
}
<div class="chatBox">
<div class="textFields">
</div>
</div>
I already tried on .chatBox
to add display: flex, flex-direction: column-reverse
but it didnt work.
At .textFields
I tried to add column-reverse
and that is working, but only up side down, as it just reverses the elements. I thought I could prepend elements to <div>
so it would work from top. But still adding column-reverse
and prepend does the same as now in code.