On Print-preview and printouts, z-index isn't applied correctly




Print Preview
10 years ago
8 years ago


(Reporter: Jeremy, Unassigned)


1.9.2 Branch
Windows XP

Firefox Tracking Flags

(Not tracked)



(3 attachments)



10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a1pre) Gecko/2008060905 Minefield/3.1a1pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a1pre) Gecko/2008060905 Minefield/3.1a1pre

On a page with background divs (z-index of 9) behind a content div (z-index of 15) the background divs cover up the content div when looking at print preview or the page print out.

When the page is displayed with the same css in the browser, everything comes across correctly. 

Oddly, sometimes changing the Scale on the print preview can resolve this.

Reproducible: Always

Steps to Reproduce:
1.  Create page with background divs positioned behind content div.  
2.  Fill content div with quite a bit of data.
3.  Click File -> Print Preview
Actual Results:  
Background divs cover up the content div.

Expected Results:  
Background divs should be behind the content div, as it looks in the actual browser.

Also, absolute positioned divs don't show up after the first page in the print.

Comment 1

10 years ago
Created attachment 324293 [details]
HTML with background divs in print media

This is html that has background divs that should show behind the content div.  Background divs only shown on "print" media.

Need to click File -> Print Preview to see the background divs cover up the content div.

Comment 2

10 years ago
Created attachment 324294 [details]
HTML with background divs in "all" media

This html shows how the page should look on the print.  It is the same as the other page, but the stylesheet was set to use media="all".  In this example, you can see that the background divs are behind the content, but when you go to print the page, they will then cover the content.


10 years ago
Version: unspecified → 3.0 Branch

Comment 3

10 years ago
The second issue brought up here appears to match <a href="show_bug.cgi?id=407789" title="Absolutely positioned elements do not print after first page">Bug 407789</a>

Comment 4

10 years ago
Oddly, everything seems to work when the print preview fits into one page.  Once things spill over into a second page the z-index problems begin to arise.

Comment 5

8 years ago
Does this work in version 3.6? 
If it does work, please close the bug and set resolution to WORKSFORME.
If it does not work, please update the bug.

(generally speaking, printing is greatly improved in v3.5 and v3.6)
Whiteboard: [closeme 2010-06-15]

Comment 6

8 years ago
Just tried it with 3.6, and the problem still exists.


8 years ago
Component: General → Print Preview
Product: Firefox → Core
QA Contact: general → printing
Whiteboard: [closeme 2010-06-15]
Version: 3.0 Branch → 1.9.2 Branch
Elika, any idea what's up here?
Ever confirmed: true

Comment 8

8 years ago
Created attachment 456938 [details]
reduced testcase

Reduced testcase.
Variants that don't fail:
  - As Jeremy astutely noticed, reducing the testcase to one page
    (e.g. reducing 'height' to 7in)
  - Swapping the height onto <body> so that #fg does not continue
  - Swapping the height onto a block child of #fg and giving #fg a
    short height so that its continuation is an overflow container.

Somehow, the fact that #fg has a real continuation is causing the abspos #bg after it to paint at the wrong stacking level. Don't have any theories as to why.
You need to log in before you can comment on or make changes to this bug.