Ryan
Ryan

Reputation: 1368

Scroll bars showing on printed page in IE9?

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?

Upvotes: 10

Views: 15728

Answers (5)

hadi safari
hadi safari

Reputation: 31

Use following code on body tag in JavaScript function print:

printWin.document.write(
  '<style>div {overflow: visible !important; height:auto !important;}</style>'
);

Upvotes: 0

Crouch
Crouch

Reputation: 896

@media print{

    .dont-print
     {
        overflow:hidden;
     }

}

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

Upvotes: 0

shibualexis
shibualexis

Reputation: 4744

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

overflow:hidden !important;

Upvotes: 13

biggles
biggles

Reputation: 3061

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.

Upvotes: 2

NickGreen
NickGreen

Reputation: 1752

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; }

Upvotes: -1

Related Questions