10

I'm having an issue with IE9 showing horizontal scroll bars on a printed page even though the contents of the page fit entirely. I've tried several things to remove them in my print css. Has anyone else had this issue and found a way around it?

Chad Moran
  • 12,834
  • 2
  • 50
  • 72
Ryan
  • 1,368
  • 2
  • 10
  • 14

5 Answers5

13

I faced the same issue. It is a funny fix. Define the overflow property as important. It works. LOL on IE.

overflow:hidden !important;
shibualexis
  • 4,534
  • 3
  • 20
  • 25
  • 5
    Also worth noting is that you could use `overflow:visible!important;` too. This also gets rid of the scrollbars but *shows* any content outside. – jaypeagi Jun 24 '13 at 11:23
2

I have had this issue several times with IE in the past. It is usually a margin issue. Different browsers calculate margins differently. How are you positioning the elements? Do you have a fixed-width wrapper around the content or does the body expand to the browser width? It's really difficult to pinpoint the problem without the actual css code.

I would suggest removing any negative margins you have (IE does not like these), and check to see if you have any right margins on elements that are unnecessary.

biggles
  • 3,021
  • 5
  • 27
  • 36
0
@media print{

    .dont-print
     {
        overflow:hidden;
     }

}

dont-print is just a class name which i've used before, changed that to whatever you need

Crouch
  • 846
  • 3
  • 17
  • 32
0

Use following code on body tag in JavaScript function print:

printWin.document.write(
  '<style>div {overflow: visible !important; height:auto !important;}</style>'
);
Mohammad Usman
  • 37,952
  • 20
  • 92
  • 95
-1

Are you sure you set the right stylesheet media type? Like:

<link rel="stylesheet" href="print.css" type="text/css" media="print" />`

And try the following in your print.css:

html, body { overflow-x: hidden; }
NickGreen
  • 1,742
  • 16
  • 36