As the title suggests, I am looking for a way to stack one element under another, similar to a chat application. Currently, when the message is long, it displays correctly, but if the text fits next to each other, it aligns in that manner. I require a solution for this issue and will provide an image for reference.
<div class="other_message" v-for="item in messages" :key="item.data" v-if="-- some condition --">
{{ item.data }}
</div>
<div class="my_message" v-else>
{{ item.data }[enter image description here][1]</div>
Below are the CSS styles:
.other_message {
max-width: 60%;
float: left;
text-align: left;
background-color: #DDDDDD;
margin: 2px;
padding: 8px;
border-radius: 5px;
display: inline-block;
}
.my_message {
max-width: 60%;
float: right;
text-align: left;
background-color: #448AFF;
color: #FFFFFF;
margin: 2px;
padding: 8px;
border-radius: 5px;
}