I currently have a div that has a maximum width: 200px, inside the div there are some gaps with the white-space: nowrap and display: inline-block properties.
.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>
The current behavior is that when the length of the range A and span B exceeds the maximum width of the div, span B is wrapped in 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>
However, the width of the div does not change, which corresponds to the length of the span. It always has a width of 200 pixels, which causes a problem when there is empty space after a space.
I want the div to resize along the span without any empty space.
Can anybody help me? I do not ask for an answer directly. Some explanation would be better.
source share