When a div has white-space: pre
and has too much content, it will overflow the page, adding a scrollbar. How do I get the div to be as wide as it expands to?
Example: http://jsfiddle.net/TkcTZ/1/
If you scroll to the right, you'll see that the background only extends to the right of the viewport, not past the edge behind the overflowing text. If you inspect the div with web tools, you will see that it is because the div is only as wide as the background.
How do I make divs expand widthwise when their content overflows? I would like a CSS/HTML only solution (no javascript).