See my code snippet below. I want the text-wrapper
<div>
to be only as wide as its content. Not as wide as the parent fixed-width
<div>
.
It works as long as the content is not wrapped. But as soon as it is wrapped it is always as wide as the parent container.
How can I achieve that?
.fixed-width {
width: 800px;
display: flex;
}
.text-wrapper {
background-color: green;
display: flex;
flex-wrap: wrap;
}
.text-wrapper>div {
border: 1px dashed black;
}
<div class="fixed-width">
<div class="text-wrapper">
<div>
Bavaria ipsum dolor sit amet Schdeckalfisch
</div>
<div>
abfieseln so schee wea ko, dea ko.
</div>
<div>
Kuaschwanz i waar soweid des is schee umma Milli pfiad de Guglhupf, gwiss Mamalad.
</div>
</div>
</div>