I'd like to make a div that will inherit its child width.
It works when child has only one line, but when it becomes multiline, the parent gets width of max-width property.
HTML:
<div class="message-content">
<span>Lorem ipsumdolor ipsum dolorsit ametipsumdolor ipsum dolor sit amet ipsumdolor ipsum dolor sit amet</span>
</div>
SCSS:
.message-content {
max-width: 450px;
background: green;
padding: 15px;
border-radius: 3px;
display: inline-block;
span {
background:red;
}
}
Jsfiddle: https://jsfiddle.net/q0axyfp3/
EDIT Here's the comparison of what I'm trying to achieve (in a responsive and elegant way of course): https://jsfiddle.net/q0axyfp3/5/
Does anyone know how to fix it?
Thank you very much