Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
491 views
in Technique[技术] by (71.8m points)

css - 100% width bg images not extending on horizontal scroll

I'm noticing this issue. I made a quick screen capture to demonstrate: http://dl.dropbox.com/u/904456/2010-06-14_2323.swf

Basically when you have a min-width set and the viewport goes under that constraint, a horizontal scroll bar appears. Pretty much what you would expect, but when you scroll over horizontally all elements that are suppose to extend across the entire width of the page and have background images/colors different from the body do not extend. If you resize the viewport it seems to catch up.

Is this a known issue? You can see it on a lot of sites, http://gowalla.com for example.

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I managed to solve this issue on gowalla and stackoverflow (it happens to the footer) by adding a min-width to the body element. I think that on your own site though, it would be better to apply it to a wrapper div that encompasses ALL of the page's content (including the footer).

You will need to set it's value to the minimum fixed width of the content, so if your main content div is set to be 960px wide, then that's probably what you want (but you may need to tweak to account for extra margins/borders etc).

Here's an example: http://jsfiddle.net/qUyp2/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...