Can the width of a div be automatically set to match its closest sibling when the width is set to width: auto;
?
In my coding example on jsFiddle, you can observe three colored divs - red, green, and blue. I am aiming for the blue div to adjust its size based on the dynamically changing width of the green div. If the green div ends up being 200px wide, then I want the blue div to mirror that.
Initially, my strategy involved placing the blue div inside the green one and applying display: inline-block
to the child, but unfortunately, this approach did not yield the desired result.
Essentially, I need a solution where an increase in content within the blue div does not impact the width of the green div (or the container div). How can I accomplish this task?