我正在制作一个打印页面,让我有点困扰。当我打印特定页面时,似乎无法覆盖IE11的默认页面设置。
也许这是不可能的,但根据我搜索和了解到的,应该是可以实现的。
我有这个样式:
<style type="text/css">
@media print {
@page Section1{
size:21.0cm 29.7cm;
margin:1cm 1cm 1cm 1cm;
}
<!--@page { margin-left: 1cm; margin-right:1cm; margin-top:1cm; margin-bottom:1cm; }-->
@page :header { content: none ;}
@page :footer { content: none ;}
}
div.Section1 {
page:Section1;
}
body, td {
margin: 0px;
color:#000000;
background:#FFFFFF;
}
h1 {
font-size: 16pt;
}
.header {
font-size: 10pt;
font-weight: bold;
}
.header2 {
font-weight: bold;
vertical-align: top;
text-align:center;
}
.total {
font-weight: bold;
text-align:center;
}
.total_right {
font-weight: bold;
text-align:right;
}
.noborder {
text-align:center;
border:none;
}
.text {
text-align:center;
}
.text_right {
text-align:right;
}
.text_left {
text-align:left;
}
.onlytopcenter {
border-top-color:#000000;
border-bottom:none;
border-left:none;
border-right:none;
text-align:center
}
td {
border: solid 1px;
border-color:#CCCCCC;
padding:1px;
font-family: Arial;
font-size: 7pt;
}
table {
border-collapse: collapse;
}
</style>
并且将其应用到我的内容中,调用方式如下:
<div class="Section1">
<table>
...
...
</table>
</div>
当我打印页面时,总是得到默认的边距为19.05毫米(我想)。我可以手动更改,但这对于许多用户使用的系统来说是不可行的。我做错了什么?