简体   繁体   中英

@media print and IE8

My goal is to have this page printed from IE8 without the browser's footer and header appearing on it (page number and url). It prints the page in the landscape position (after inserting a lot of text where is "hello"), so it isn't a @media problem as I was thinking before, but for some reason IE puts his header right over the page text!

It works fine on Chrome, though. Any ideas? Here is my code:

<head>

    <!--[if lt IE 9]>
        <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
    <![endif]-->
    <!--[if lte IE 9]>
        <link rel="stylesheet" media="print" href="/print.css" type="text/css" />
    <![endif]-->

    <style type="text/css"> 

    @page 
        {
            size: A4;   
            margin: 0mm;  
        }

    body
    {
      margin: 0px auto;
    }

    @media screen, projection{ }
   </style>

 </head>
 <body>
    Hello
 </body>

And from my print.css:

@media print{

    body 
    {
    margin: 0px; 
    padding: 0px; 
    }

@page 
    {
    margin: 0in !important; 
    size: auto landscape;  
    }  

 }

By the way, I know I can remove IE's header and footer on Page Setup but the client won't have the project that way.

This documentation may help: http://msdn.microsoft.com/en-us/library/ms530841(v=vs.85).aspx .

Perhaps try:

@page {
 @top-left { display: none; }
 @bottom-center { display: none; }
 /* and so on */   
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM