<div class="container">
<div class="content">
Banana
</div>
</div>
Suppose the 'content' element should always occupy a width of either 0, 25, 50, 75 or 100%, depending on its content. If the word 'Banana' takes up 20% of the 'container' width, then 'content' should be sized at 25%. If the word 'Mango' occupies 40% of the 'container' width, 'content' should have a size of 50%. The actual contents and widths are unknown, but they must align with these predefined values.
Can this behavior be achieved using only CSS? If not, what would be the simplest approach to accomplish this?
Edit: I intend to place any number of 'content' divs within the 'container'. Each one should adhere to one of these specified percentage widths. Additionally, the exact quantity of content divs is undetermined.