Forum Moderators: not2easy

Message Too Old, No Replies

Opera ignores body background image in print stylesheet?

         

aastra

3:04 am on Jan 28, 2004 (gmt 0)

10+ Year Member



In my screen stylesheet I establish a background image for the body. In my print stylesheet I specify a different background image for the body. Do a print preview and Netscape and Internet Explorer behave as expected, but Opera (7.23) doesn't update the background image. Here's a link...

<Sorry, no URLs. See TOS [webmasterworld.com]>

Please enlighten! Thanks.

[edited by: tedster at 5:44 am (utc) on Jan. 28, 2004]

DrDoc

3:56 am on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

There is nothing you can do about this, since the browser behavior depends on a browser setting (which makes backgrounds print or not print).

There was a similar thread about this in the HTML and Browsers forum: [webmasterworld.com...]

aastra

4:41 am on Jan 28, 2004 (gmt 0)

10+ Year Member



But shouldn't the printed document nevertheless reflect the print stylesheet, regardless of the browser setting?

In my screen stylesheet I've specified a body background image. When the page is printed I want that background image to be gone altogether, so I removed the body background image from the print stylesheet. Netscape and IE treat this situation logically, they print no background image, but Opera prints the background image from the screen stylesheet!

And yet every other style in the print stylesheet is displayed (or not displayed) correctly.

So to clarify, I don't want the background image to appear in prints, which is why I didn't include it in my print stylesheet. But Opera goes and gets it anyway, from the screen stylesheet.

aastra

4:44 am on Jan 28, 2004 (gmt 0)

10+ Year Member



"But shouldn't the printed document nevertheless reflect the print stylesheet, regardless of the browser setting?"

By this I mean, shouldn't the background image that the browser setting affects nevertheless be the CORRECT background image (the correct one being the one in the print stylesheet)?

DrDoc

5:03 am on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



aah...

Does your print declaration come after the screen styles? What are you using to "remove" the background --

background:none
?

aastra

5:13 am on Jan 28, 2004 (gmt 0)

10+ Year Member



The screen stylesheet declaration comes first. The print stylesheet declaration is on the line below it.

I had been using "background-image: none" in my print stylesheet, but since the results made no sense to me I created the simple test files that I linked to in my original post. That way I could easily see what the browser was doing when I clicked print preview. Netscape and IE showed the "print" background, but Opera showed the "screen" background.

DrDoc

5:30 am on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Which version of Opera are you running?

aastra

8:41 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



I'm running Opera 7.23.

So, does Opera ignore body background images when they're specified in print stylesheets?

Did I discover a bug? Do I get a box of chocolates or something?

DrDoc

9:07 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm... odd. I'm running Opera 7.20, and it doesn't print the background for me...
...and mine's even set to "Print page background" :(

Note: It DOES print backgrounds, just not in aastra's example (which is correct behavior)

aastra

9:34 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



I've changed things a bit and put the print styles and the screen styles into the same stylesheet file, using "@media print" and "@media screen".

But the result is the same as before.

DrDoc

9:35 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sounds like a bug to me...
Maybe there's something on Opera's site about it?

aevea

10:35 pm on Jan 28, 2004 (gmt 0)

10+ Year Member



I've been playing around with @media print rules in opera lately and haven't had any problems (firebird was the browser behaving badly). Could you give us a snippet of the appropriate code?

Adam

pageoneresults

11:06 pm on Jan 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just a wild guess, try adding this to your body rule...

body, html{styles...}

I'm seeing Opera 7.23 do some unusual things with background images assigned to the body element. When I add the html to the rule, everything works as expected.

aastra

3:10 am on Jan 29, 2004 (gmt 0)

10+ Year Member



Okay, I tried revising the stylesheet to read:

body, html { blah blah }

...instead of:

body { blah blah }

So do a print preview in Opera and the "body background image for print" now appears as a background beneath the <p> tags in the body area, while the "body background image for screen" appears everywhere else (outside the <p> tags).

In Netscape and IE the "body background image for print" also appears as a background for <p> tags.

I've reduced the HTML page and the CSS file to the bare essentials, you could create them yourselves in moments. The stylesheet has "@media screen" styles and "@media print" styles. The <body> tag for screen contains a background image, the <body> tag for print contains a different background image. The <p> tag is the same for screen and print, except the font size is different (which allows me to confirm that the print styles are being read at all).

Can anyone can show me an example they've done in which the body background is displayed correctly for print? I'd love to see it. Otherwise I'm going to give up on Opera for the moment and hope they fix this bug in later versions.