Making a vertically scrolling parent div which does not cause overflow of children
- by marq
I have something as follows:
<div style="float: left; height: 20px; overflow-y: scroll">
<div>hello this is a test</div>
<div>hello this is another test</div>
<div>t1</div>
<div>t2</div>
<div>t3</div>
</div>
The parent div grows to the appropriate width to fit the largest child (which is what I want). However, the vertical scrollbar causes the inner width to be smaller, which causes the largest child to wrap.
Is there a way to get the parent to grow to the width of the largest child + the width of the scroll bar? I've tried every margin trick I know, but nothing.