Using media="print" for IE8

css, html, internet-explorer, internet-explorer-8, printing

Solution

I finally figured out what went wrong (with a lot of luck..)

For some reason the following css didn't do the job:

#divID1, #divID2, #divID3 { display: none; }

Changed it to:

#divID1 {
   display: none;
}

#divID2 {
   display: none;
}

#divID3 {
   display: none;
}

and now it works in IE8. Can't really figure out why..

Problem

``` <link rel="stylesheet" href="printStyle.css" media="print" /> ``` This line fixes the print preview for Chrome / IE7 and IE9 but it doesn't seem to work with IE8.. Has anyone got any idea? After some comments I realized it's a IE8 problem. I've been goolgeing around and came up with adding the following on the top of my section: ``` <!--[if lt IE 9]> <script src="http://html5shiv-printshiv.googlecode.com/svn/trunk/html5shiv-printshiv.js"></script> <![endif]--> ``` This makes it possible to use a general stylesheet with `@media print {}`. This, again, works in IE7 / 9 and not in IE8.. Can't, again, really figure out why. But the printshiv does work otherwise I wouldn't be able to get the correct print preview in IE7.

Original source

Related problems