Forum Moderators: not2easy

Message Too Old, No Replies

Media=print NOT displaying images in Opera

OK in IE7 and FF2

         

lavazza

7:33 pm on Dec 8, 2007 (gmt 0)

10+ Year Member



Valid HTML and CSS (all files)

Scenario:
I want to include low-res images for on-screen display and high-res images for users to print

<!--
CSS links in the <head>
-->
<link rel="stylesheet" type="text/css" media="screen" href="../myCssFolder/myScreensSheet.css">
<link rel="stylesheet" type="text/css" media="print" href="../myCssFolder/myPrintSheet.css">

/* <from myScreensSheet.css> */
.printOnly {
display: none;
}

.screenOnly {
display:inline;
}
/* </fromMyScreensSheet> */

/* <from myPrintSheet.css> */
img, .screenOnly, .copyrighted, #myHeader, #myFooter {
display: none;
}
/* NB including OR excluding img here makes no difference to the bug */

.printOnly {
display: run-in! important;
}
/* </from myPrintSheet.css> */

<html>

<img class="screenOnly" alt="Screen Only" src="screen-only.jpg">
<img class="printOnly" alt="Print Only" src="print-only.jpg">

Output: Screen:
-------------------------
Displays ALL content as intended in FF2, IE7 and Opera 9.22

Output: Print:
-------------------------
OK:
------
in FF2 and IE7:
Does display all (text and images) as intended (i.e some sections are visible, others are invisible)

in Opera
Does display text as intended

BUG:
------
Does NOT display ANY IMAGES in Opera; the alt tags are displayed instead

So far, my Google-Fu and my own lack of CSS knowledge have conspired to let me down...

So, here I am (again), asking for HELP!

Note: No physical printer tested yet, instead only using the browsers'print previews and a virtual printer (CutePDF)... but even if it DOES work as intended on a physical printer... its still a bug at print-preview time, which is... erm... bugging the %$&@! out of me

penders

12:30 pm on Dec 9, 2007 (gmt 0)

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



If an IMG is set to display:none; then Opera will not even download the image, whereas other browsers will.

However, setting the img to display:block; should cause the image to be downloaded. You are trying to set display:run-in; - I wonder whether this is an issue? As far as I'm aware, display:run-in; is only supported by Opera9, no other browser supports this property correctly.

What if, in your myPrintSheet.css stylesheet, you try setting:

img.printOnly { 
display:inline! important;
}

lavazza

6:44 pm on Dec 10, 2007 (gmt 0)

10+ Year Member



Thanks for the reply penders

If an IMG is set to display:none; then Opera will not even download the image, whereas other browsers will.

Hmmm... so the others DO download the image? Bah humbug! This somewhat defeats at least part of the purpose (obviating superfluous bandwidth load)

You are trying to set display:run-in; - I wonder whether this is an issue?

I wondered this too... and have read the w3c display properties [w3.org] and tried block, inline, run-in and compact... all to no avail

As far as I'm aware, display:run-in; is only supported by Opera9, no other browser supports this property correctly.

Hmmm.. I'm beginning to think javascript might be the way to go... or maybe providing a link to a 'print-quality' image... or, or, or something else... - a shame cos the CSS approach seems elegant

What if, in your myPrintSheet.css stylesheet, you try setting:

img.printOnly {
display:inline! important;
}

Tried it, again... still no luck

Thanks for taking the time to think on my behalf though

I appreciate it :)

lavazza

6:56 pm on Dec 28, 2007 (gmt 0)

10+ Year Member



bump