I have a div somewhere on the page, and I need to give it a background image that does not move when you scroll your browser window. This is my code:
#mydiv { float:left; width:540px; margin:40px 0px 0px 20px; background:url(/images/myimage.jpg) no-repeat fixed 0px 0px transparent; }
The problem is that my background image is positioned relative to the canvas, and I need it to be positioned relative to #mydiv and not yet scrolling.
To illustrate the problem, see here http://jsfiddle.net/QPrUz/1/
In the example, #div1 looks great, but #div2 does not show the background at all, since it is placed relative to the canvas instead of #div2 .
Any suggestions are welcome.
PS
iframe is not an option.
source share