我正在尝试绘制2张桌子(5x2),并将它们打印在纸的2面上。 问题是双面打印的桌子不在同一位置。
在第一页上,边缘的边距为:11mm,9mm,9mm,11mm(T-R-B-L)
在第二页上,边缘的边距为:9mm,11mm,11mm,9mm(T-R-B-L)
我认为问题出在打印机或浏览器(使用Chrome)的默认边距设置。我尝试使用@page规则(将所有边缘的边距设置为10mm)修复该问题,但是没有运气,它似乎不起作用(不影响边距)。
我附上了下面的html和CSS,请帮忙。谢谢。
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="reset.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 15px;"></div></div><div style="clear: both; page-break-after: right;"></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div class="termBlock"><div class="termContent" style="font-weight: bold; font-size: 14px;"></div></div><div style="clear: both; page-break-after: right;"></div>
</body></html>
style.css
@page {
size: legal portrait;
margin: 10mm 10mm 10mm 10mm;
}
@media print {
@page {
size: legal portrait;
margin: 10mm 10mm 10mm 10mm;
}
}
.termBlock {
width: 100%;
height: 100%;
max-width: 368px;
max-height: 193px;
border: 1px dashed lightblue;
float: left;
}
.termContent {
padding: 10px;
}
reset.css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}