Print CSS renders landscape page

I created a media=“print” stylesheet. When I tested a page, it output as landscape with 3/4" border on left side and 3.5" border on the right (all content was between these borders).

Is there a property to add to this page that will print the page in portrait orientation?


AFAIK, the orientation, landscape vs. portrait, is a printer setting, not a CSS specification. Check your printer option settings.
Also, check how the page looks in the browser’s “print preview”.

My printer always prints as Portrait (it’s the default). This particular page prints as Landscape with no warning. I tried the following, but it did not work for me:

@page { size: portrait }


Link? And which browser?

It’s not posted yet. I’m using WAMP. Firefox 3.0.3.


Well how bout the code you are using?

The php and css pages are a yard long!

I tried this to get a “landscape” print page (class=“landscape”)

<style type="text/css" media="print">
@page land {size: landscape;}
.landscape {page: land;}
@page port {size: portrait;}
.portrait {page: port;}

It doesn’t seem to be supported by IE6.
But in Opera the print-view looks like it’s in landscape orientation. If you then choose “Print Options” it opens the printer dialog box (in my case HP) where landscape orietation can be selected.
In Firefox 2, choose “Print Preview”, then click “landscape”, and the print preview will be in landscape orientation. And the printer’s landscape orientation setting should already be selected.
But it probably depends some on your printer. From
4. Properties, Table Note 2

The printer MAY ignore the value landscape if it lacks the memory to support landscape printing.

I imagine it’s similar for portrait orientation as well. That is Opera and Firefox should allow the user to choose the format that the CSS is written to use. With IE it’s probably portrait only.

EDIT: No need to post the PHP code, the HTML that’s output would be fine (and the CSS file if it’s external).

OK, that page was very informative. When I checked the printer defaults for the web page, it was set at landscape! Yet every other time I print it output Portrait.

I don’t understand this, but I consider this resolved. Thanks for your attention!