I have a fixed width div container, and some children can be larger than the parent.
Is it possible to allow all children the full width of the scrollable area from the parent ( overflow: auto )?
#container { width: 200px; background-color: grey; overflow:auto; margin:10px; } #container p{ display:block; background-color: green; white-space: nowrap; width: 100%; }
<div id="container"> <p>Sample Text 1</p> <p>Sample Text 2</p> <p>A very very very very very long Sample Text</p> </div>
Here is the fiddle . When you go right, you can see that the background color of the children is less than the content.

html css css3
Martin
source share