phi*_*hag 10
您可以使用@pageCSS规则标记打印页面的大小和边距:
/* In CSS, not JavaScript */
@page {
size: A4 landscape;
margin: 42pt 12pt;
}
@media print {
/* Define print-specific styles here, for example toning down the decoration
of hyperlinks and removing the navigation. */
a {color: inherit !important; text-decoration: none !important;}
nav {display: none;}
}
Run Code Online (Sandbox Code Playgroud)
然而,浏览器支持是不稳定的 - 除了王子XML,只有IE8 +和Opera支持它.如果您希望对打印进行精确的跨浏览器控制,请考虑(通常是服务器端)PDF输出机制.