I'm currently dealing with a div that has a max-width of 200px. Inside this div, there are some spans with the properties white-space: nowrap and display: inline-block.
.a {
max-width:200px;
}
.b {
display: inline-block;
white-space:nowrap;
}
<div class="a">
<span class="b">A</span> <span class="b">B</span>
<span class="b">C</span>
</div>
Currently, when the length of span A and span B exceeds the max-width of the div, span B is wrapped into the next line.
<div class="a">
<span class="b">A</span> Empty space here
<span class="b">B</span> Empty space here
<span class="b">C</span> Empty space here
</div>
The issue I am facing is that the width of the div does not adjust according to the length of the span. It always remains at a width of 200px, leaving empty space after the span.
My goal is to ensure that the div resizes based on the length of the span, without any unnecessary empty space.
If anyone could provide an explanation or solution for this, it would be greatly appreciated.\