I'm trying to display a lot of data that requires a horizontal scroll.
It came to my attention that the body doesn't automatically resize to the width of its children. This becomes an issue because of the styling required on some of the other elements that should be automatically resized to match the element that extends beyond the viewport.
Unfortunately, it stops at the width of the body. You would think body would also resize to match the width of its children, but it doesn't.
How do I make it so body and/or the other elements automatically adjust? This occurs in chrome, firefox, edge, and ie11
See fiddle and code:
body {
border: 1px solid red;
padding: 1rem;
}
#extra-long {
background-color: salmon;
width: 200vw;
}
#other-element {
background-color: cornflowerblue;
}
<div id="extra-long">This extends beyond the view port</div>
<div id="other-element">This should automatically extend beyond the viewport, but it doesn't</div>