I'm in the process of developing a chat application and need to utilize flexbox for arranging messages. However, I've encountered an issue where using display: flex
and flex-direction: row
causes text overflow within the message container. How can I ensure that the parent div (with class message
) scales with the content inside the message-text
div?
.message {
margin-top: 1%;
border-top: solid 1px lightgrey;
padding: 1%;
}
.message-icon {
width: 60px;
height: 60px;
background: red;
margin-right: 1%;
}
.message-name {
width: 50px;
}
.message-text {
width: 100%;
min-height: 20px;
padding: 2px;
border-radius: 2%;
display: inline-block;
}
<div class='message'>
<div class='message-icon'></div>
<div class='message-name'>Steve:</div>
<div class='message-text'>THIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS
IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS IS A MESSAGETHIS
IS A MESSAGETHIS IS A MESSAGE</div>
</div>