我创建了一些PHP脚本,称为打印脚本。但是,不幸的是我有一个小问题。
您可以在照片中看到问题:
当第一个TD中的文本位于最后一页而第二个和第三个TD中的图片位于新页面中时,我需要确保此分页符的安全。
我尝试使用
page-break-inside:避免!important;
比
空白:nowrap;
...但不帮忙
这是我的表格CSS。
table.prvni {
margin: 100px 10px 0px 10px;
padding-bottom: 50px;
page-break-inside: avoid !important;
}
caption {
text-align: left;
font-weight: 600;
font-size: 13px;
padding-bottom: 15px;
}
th:first-child {
width: 250px;
padding: 3px 6px;
}
th:last-child {
width: 200px;
padding: 3px 3px;
}
th {
width: 200px;
padding: 3px 6px;
}
tr:first-child {
background: #ecefef;
font-size: 13px;
font-weight: 600;
}
tr {
background: #f7fafa;
font-size: 11px;
font-weight: 400;
}
td:first-child {
text-align: justify;
font-size: 12px;
font-weight: 400;
font-style: normal;
}
td:last-child {
font-style: normal;
font-weight: 400;
font-size: 12px;
}
td {
font-style: italic;
font-size: 12px;
text-align: center;
}
有人可以帮忙吗?
答案 0 :(得分:0)
已解决。
只需更改CSS,重要的是分页符参数。
table.prvni {
margin: 100px 10px 0px 10px;
padding-bottom: 50px;
page-break-inside:auto;
page-break-after: always;
}
table.druha {
margin: 50px 10px 0px 10px;
padding-bottom: 50px;
page-break-inside:auto;
}
caption {
text-align: left;
font-weight: 600;
font-size: 13px;
padding-bottom: 15px;
}
th:first-child {
width: 250px;
padding: 3px 6px;
}
th:last-child {
width: 200px;
padding: 3px 3px;
}
th {
width: 200px;
padding: 3px 6px;
}
tr {
background: #f7fafa;
font-size: 11px;
font-weight: 400;
page-break-inside:avoid;
page-break-after:auto;
}
td:first-child {
text-align: justify;
font-size: 12px;
font-weight: 400;
font-style: normal;
}
td:last-child {
font-style: normal;
font-weight: 400;
font-size: 12px;
}
td {
font-style: italic;
font-size: 12px;
text-align: center;
}
#maly {
font-style: normal;
font-weight: 400;
font-size: 10px;
}