SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    @media print - prints 3 pages in IE but 1 page in Firefox

    When I print preview from Firefox, it shows it will print one page which is what I want. When print preview using Microsoft IE, it shows the page on one page but says it will print 2 pages, and actually prints three. The last two pages are blank.

    Here's the code snippet in the page:
    HTML Code:
    <link href="style.css" rel="stylesheet" type="text/css" />
    ....
    <div class="class1">
    <div class="class2">enough stuff to fill 3/4 page<div class="class2">
    </ div class="class1">
    Here's the code from the style sheet:
    HTML Code:
    @page { size 8.5in 11in; margin: 2cm }
    @media screen {
    	body {
    		font-family: Verdana, Arial, Helvetica, sans-serif;
    		font-size: 10px;
    	}
    }
    @media print {
    	body {
    		font-family: Verdana, Arial, Helvetica, sans-serif;
    		font-size: 8px;
    	}
    	@page { size 8.5in 11in; margin: 2cm }
    }
    Any ideas how to force IE to print just the one page?
    Last edited by WebDevGuy; Oct 2, 2007 at 13:47.

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,353
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    HI,

    Can't really help you much here as my IE stand alone doesn't work in print preview anyway (unless you also have the problem in IE7).

    Fix your code anyway - what is this?

    [code]
    </ div class="class1">
    [code]

    You can't add classes to closing tags.

    I'm guessing your print problem is probably related to the way you have styled some elements. Make sure nothing is styled and then see what happens and then try narrowing the problem down by a process of elimination.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Try leaving out the @page line and see if that fixes it.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I took the surrounding <div class="class1"> out and it worked - I don't know why but it did. (BTW, I did have </div> in the actual code)

    Thanks for your help guys.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •