Problems with position:absolute on element when printing - IE8
I have run into a problem with absolute positioning on elements in IE8 when printing. I have my print stylesheet, and in this I'm trying to position an element in the top right corner of the first printed page.
The problem is that when the element is placed on page two, IE8 thinks that the top of the page in on page two, instead of page one.
This is in my print.css:
.myElem{
position:absolute;
top:0;
right:0;
width:230px;
}
In all other browsers (Opera 11, Firefox 3.6, Safari 5, Chrome 11, IE9, IE9 compatibility mode, IE8 compatibility mode) the .myElem-div will be printed on the first page in the top right corner. But in IE8 the div is printed in the top right corner of the second page. As said before the div is located "on the second print pa开发者_如何转开发ge" in the DOM. I can't move the element up earlier in my DOM, so this is not a solution.
Actually it's the same problem as descibed in the comments by other users here: http://msdn.microsoft.com/en-us/library/ms533005%28v=vs.85%29.aspx#CommunityContent
Anyone have a solution to this?
Thank you very muvh in advance!
Regards, Kim
Two possible workarounds... not really fixes.
Create printer-friendly versions of the pages that do not require a
doctype
, which is probably causing IE8 to choke. Of course, this is a lot of work... unless you do not have too many pages or you can generate those pages dynamically using server side tech.Create an IE8-only stylesheet using conditional comments, example
<!-- [if IE 8]> <link rel="stylesheet" type="text/css" href="ie-8.0.css" /> <![endif]-->
and use this sheet to remove thatdiv
altogether with adisplay:none;
, assuming that you could do without it.
精彩评论