I don't remember who said it, but someone once pointed out that if you solve a tricky problem... blog it. You'll help out the next sucker who is trying to solve it.

Recently I ran into a background image positioning bug in Opera 7/8. Well, ok, I thought it was a bug; but actually it was user error. Basically, I had a background image positioned center center. In everything except Opera, it was sitting - as expected - bang in the center of the page.

In Opera, the image was sliding up off the top of the browser canvas. I eventually figured out that Opera was positioning the image according to the length of the content, not the visible canvas area. Throw in some really long content and you'll find the image way down in the middle.

The problem was I'd forgotten to set the background-attachment, despite the fact that I did want it to be fixed. Since I hadn't specified what I wanted, Opera defaulted to the vertical centre of the element. Which, when you think it through, is the right thing to do - I'd said it should be in the middle of the element and the element was as long as the content. The other browsers use for 'we think you wanted...' approach and default to the length of the viewport.

So I explicitly set the background attachment:

background-image: url("img/watermark.gif");
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;

...and all is well.

In my defence, half the office had a look at the problem and they didn't spot it either :) The moral of the story: beware of default settings and the lazy habits they breed. It will catch you out eventually. In this case, the overly-forgiving defaults of IE and Firefox had let me slip into the bad habit of expecting a background setting that I hadn't actually specified.