CSS for Printers

liunx

Guest
I want to print document in Landscape. This the code I thought would accomplish this. It didn't. Is there anything else I could try?

<html>
<head>
<STYLE type="text/css">

@media print {
@page { size 8.5in 11in landscape ; margin: 2cm; writing-mode: tb-rl;}
BODY {font-size: 10pt; line-height: 120%; background: white;}

}
</style>
</head>
<body>
PRINT LANDSCAPE
</body>
</hHello,

The @page attribute, to my knowledge, only works in Opera, and its support in Opera is very buggy. It doesn't work in Internet Explorer or Mozilla so for the time being your best bet is to just not worry about it. Your best bet is to just make a little statement on your page saying to change your printer settings to print in landscape.Sure this:<style type="text/css" media="print">

</style>Or this:<style type="text/css">

@import "blah.css" print;

</style>Or this:<link rel="stylesheet" type="text/css" media="print" href=http://www.webdeveloper.com/forum/archive/index.php/"blah.css" />Would work for print media style sheets.He wants to know how to automatically have it set to print in landscape though, instead of the normal portrait.Yes, but as you said @page{} is only (and badly) supported in Opera, so perhaps the landscape rule would work if it was applied via any of the methods I mentioned.Ah, good point.ignoring the part that lavalamp mentioned (though you should try that as well ;)) but i also noticed that in your code you forgot the colon:

@page { size: 8.5in 11in landscape ;It used to work in Mozilla but they altered the UA to give the user more control.
 
Back
Top