浏览器横向打印
1、用橫向打印的css樣式,但實際使用發現只有谷歌瀏覽器能生效
@page {size: landscape;}
2、用要打印的內容放到一個div中,然后用css樣式把div旋轉90度。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
@media print
{
.noprint
{
display: none;
}
.divPint
{
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
position:absolute;left:-100px;
width: 960px;height:500px;margin-top:250px;
border:solid 1px black;
display:block;
}
.divShow
{
display:none;
}
}
@media screen
{
.divPint
{
display: none;
}
.divShow
{
padding: 10px; margin: 0px auto; width: 960px;height:500px;border:solid 1px black;
}
}
</style>
</head>
<body style='padding: 0px; margin: 0px;'>
<form id="form1" runat="server">
<div>
<div class='divPint'>
我是打印的div
</div>
<div class='divShow'>
我是顯示的div
</div>
<div class="noprint" id="tool" runat="server">
<input id="Button1" type="button" value="打印" onclick='javascript:window.print();' /> <input
id="Button2" type="button" value="關閉" onclick='javascript:window.close();' />
</div>
</div>
</form>
</body>
</html>
總結
- 上一篇: es6解构的含义是什么
- 下一篇: Java static initiali