Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with 100% background-image wrapper disappearing when scrolling

I have http://www.mrfishermusic.com/

You'll notice that the main wrapper is 1042px (#main). Then I have #container surrounding that which is width 100%. I made it like this because the background image of the page is huge width wise.

The problem is if the browser is resized small horizontally... say like.. 700px wide (or way smaller, like on an iPhone), when you scroll to the right the header and footer both just disappear, although the #main wrapper remains intact.

I see some other people had this issue but I'm not a CSS ninja so I couldn't quite reproduce the solution onto my site - I apologize if this has been asked before.

Thanks!

like image 296
Tallboy Avatar asked Dec 29 '25 02:12

Tallboy


1 Answers

The container size of 100% is relative to the viewport and is not updated when you scroll/resize. You have several options:

  • use javascript to handle viewport size changes
  • set the header container minimal size in pixels
  • set the background on body instead (because it's not limited to the viewport size) : background-image: url(background.png); background-position: center top;
like image 174
skolima Avatar answered Dec 31 '25 16:12

skolima



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!