0

What is the proper way to set up an HTML page so that a div's background color will expand to fill the window when the page scrolls horizontally? For example, lets say I have a wide data table that expands beyond the width of my window. If the user scrolls to the right to see all the data, I want the background colors in the header and footer to show instead of being cut off. I don't want to stop a page from scrolling horizontally or to set a fixed width for my content. I don't want to set position:fixed because I don't want these divs always in the viewport.

If you were starting a page from scratch and you only had three divs (#header, #content, and #footer), how would you style it so that the background colors of the header and footer were always visible, even when the #content div height and width varied?

PixelGraph
  • 221
  • 2
  • 7
  • absolute position them, make content scrollable – Brett Weber Apr 30 '14 at 21:11
  • 2
    possible duplicate: http://stackoverflow.com/questions/3042979/100-width-bg-images-not-extending-on-horizontal-scroll – andi Apr 30 '14 at 21:11
  • 1
    possible duplicate of http://stackoverflow.com/questions/8704817/how-to-style-a-div-to-have-a-background-color-for-the-entire-width-of-the-conten – Matt H Apr 30 '14 at 21:11

0 Answers0