Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

disable horizontal scroll on background image

New Here ,
Jul 10, 2010 Jul 10, 2010

I would like to be able to disable horizontal scroll on the background image:

http://www.elliotnewman.com/index/test5.html

like this page:

http://www.steininger.com.au/purchasing.html

I tried looking though the source but could not find where it controls this...

50.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 10, 2010 Jul 10, 2010

body { background-attachment:fixed; }

Be aware that your background would have to tile properly to make this look right (note the visual repeat in the background on your linked page).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2010 Jul 10, 2010

Hmmmm.... thats cool, but this is not quite what I am after. I don't

want the image to repeat, I only want there to be H-scroll bars

appearing when the window is reduced past the width of the main image

(or the main content divs) - not when it passes the width of the

wrapper.

So to summarise I don't want the scroll bars to care about the wrapper

div if the browser window cannot fit it in... I also don't want the

centering of the page to be based on the wrapper div, so when you

reduce the browser size everything inside the wrapper div remains

centered even though the wrapper has cropped some width.

Does that make sense?

Maybe it's a simple case of taking the wrapper div out of the context

of the rest of the page, and tell it never to have scroll bars. Then I

would have the centering the way I want it too?

- E

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 10, 2010 Jul 10, 2010
LATEST

I don't

want the image to repeat, I only want there to be H-scroll bars 

appearing when the window is reduced past the width of the main image 

(or the main content divs) - not when it passes the width of the 

wrapper.

Sounds like you would want an arrangement such as this -

Body - uniform background color with background image that centers using background-position:center.

Wrapper - fixed width, centering containing body content.

Is that what you are looking for?  The wrapper will always center in the browser, as will the background image behind it.  Horizontal scrollbars will only appear when the viewport width is less than the wrapper width.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines