你好,我希望有人能帮助我解决这个问题。基本上,我有一个分页问题,让我分解我所做的每一个小步骤:分页符不能正常工作
#1最初,我有一个分页问题使用window.print(),由于我是使用表格标签。
@media print {
@page :first{
margin-top:1cm;
}
@page {
margin-top:3cm;
}
}
h1, h2, h3, h4, div, table, tr, td, th{
font-family:Arial, Helvetica, sans-serif;
border-collapse:collapse;
width:auto;
margin:11px;
}
.cuerpo{
position:relative;
top:200px;
right:9px;
font-size:9px;
}
.cuerpo{
padding-top:150px;
font-size:9px;
font-weight:500;
page-break-after:always;
}
.cuerpo tr {
padding:3px;
line-height:15px;
height:10px;
width:15px;
}
.cuerpo tbody td, .cuerpo thead th{
border:1px solid #000000;
padding:1px;
}
http://jsfiddle.net/the_best/u99BQ/
#2。然后,我在那个分页可与一个论坛找到 '显示:块;'相反,并改变了字体大小:13px,所以它看起来不太大,可以适合在纸上。 我在css中添加了特定的代码行,这是发生了什么事情: 如果您尝试font-size = 100%会正确分解,但看起来会太大。
@media print {
@page :first{
margin-top:1cm;
}
@page {
margin-top:3cm;
}
}
h1, h2, h3, h4, div, table, tr, td, th{
font-family:Arial, Helvetica, sans-serif;
border-collapse:collapse;
}
thead tr .ancho {
width:95;
width:80;
}
#nombre-hotel {
text-align:center;
}
#cuerpo{
page-break-inside:avoid;
padding-top:150px;
position:relative;
top:50px;
border-collapse:collapse;
font-size:90%;
}
#cuerpo tr{
page-break-inside:avoid;
page-break-after:auto;
/*page-break-after:auto;*/
display:block;
/*padding:3px;
line-height:15px;
height:10px;
width:15px;*/
}
#cuerpo td, #cuerpo th{
page-break-inside:avoid;
border:solid 1px #CCCCCC;
}
http://jsfiddle.net/the_best/VwTa7/
基本上问题都与一个合适的字体大小,以获得分页的权利,并调整细胞。不幸的是,这并不适合我。如果有人能帮助我,我会很感激。如果您需要详细信息,请告诉我。
不能在您发布的小提琴上工作。我想你错过了一个事实,即如果你不添加“display:block;”在#cuerpo tr它不会分页。因为据我发现,page-break属性只适用于块元素,所以我试图使用display:block来获得干净的结果,如果可能的话。如果还有另一种方式,我会发生的事情要知道。 – user2989570