Forum Moderators: open

Message Too Old, No Replies

Problem with background

Howto: background image that can't move when vertical scrollbar appears?

         

MasterYoda

1:41 pm on Aug 14, 2006 (gmt 0)

10+ Year Member



Hi ppl. Sorry for my English.

Situation >
I have a web page with a background jpg image that is positioned on center by css body tag.

Problem >
When a vertical scrollbar appear on the page my background image moves to the left (width of the scrollbar).

What I want>
I dont want my background image to move at all, even if a scrollbar appears on the page.

-------------------------

Can any1 help plzzzz.....

:)

MisYu

2:51 pm on Aug 14, 2006 (gmt 0)

10+ Year Member



Try using the 'fixed' property while declaring 'background' with CSS.

MasterYoda

3:50 pm on Aug 14, 2006 (gmt 0)

10+ Year Member



it is already fixed in css.

i dont have a problem with background image not moving when a text scrolls over it.

i have a problem when scroll-bar appears my image moves 10-15 px to the left. i want to avoid that.

Robin_reala

6:51 pm on Aug 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld MasterYoda!

Can you post your code? At a guess you're using Firefox (where a scrollbar appears whenever your content gets large enough to require it) and you're positioning your background image to the right hand side of the page. There are two approaches you can take to get around this:

1) Position your image away from the left hand side of the body instead of the right

2) Force a scrollbar to appear permanently (e.g. with body{overflow-y:scroll;} )