PDA

View Full Version : specify margins in css for printing


maxpouliot
08-15-2006, 06:30 PM
hi, i want to specify margins for a page (when printing). in my html code i have

<head>
<title>Imprimer feuilles d'accès</title>
<link rel="stylesheet" type="text/css" media="all" href="../../FeuillesStyles/print.css">
<link rel="stylesheet" type="text/css" media="print" href="../../FeuillesStyles/print.css">
<link href="../default_style.css" rel="stylesheet" type="text/css">
</head>

And in my css file :

@page
{
margin-top:5cm;
margin-bottom:5cm;
margin-left:5cm;
margin-right:5cm
}

#header { display: none;}
#footer {display: none; }

but it doesnt work. Anybody knows how i can do it?

Arbitrator
08-17-2006, 03:51 AM
Are you using a browser that actually supports @page? The only browser that supports that yet that I'm aware of is Opera 9. I'm not sure how @page works yet so I don't know if what you've specified will actually work for supporting browsers either. The display: none declarations should be effective at least. If not you might try something like this instead of the link element:

<style type="text/css">
@import url("../default_style.css");
@import url("../../FeuillesStyles/print.css") print;
</style>
Looking again, I notice that your main stylesheet, with a default presentation of "all", appears after your "print" stylesheet so it might override the CSS intended for print media.