I have a nested flex container. Here is the code:
<div class="parent-container">
<div class="child-container">
<span class="color-block"></span>
<span>This is a long long long long long text.</span>
</div>
</div>
.parent-container {
display: flex;
background: orange;
}
.child-container {
display: flex;
background: green;
}
.color-block {
background: yellow;
flex: 0 0 15px;
align-self: stretch;
}
Look at the result at https://codepen.io/crupest/pen/Lqwxpp.
This is the least code that reproduces my problem. Of course there are other elements in parent container.
My question is that why the last word "text" wraps even when there is remaining space at right? And how to make it not wrap? Or is there any workaround?
Thanks!
Update:
My purpose is that I want a color label in front of the text.
Thanks for @Kata Csortos pointing out that I need to say my purpose.