我按照下面这样,打印的时候还是会分页
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button id="dy">打印</button>
<div style="page-break-before: avoid;page-break-after: avoid!important;page-break-inside: avoid!important;height: 3000mm;">1111</div>
<div style="page-break-before: avoid;page-break-after: avoid!important;page-break-inside: avoid!important;">2222</div>
<div style="page-break-before: avoid;page-break-after: avoid!important;page-break-inside: avoid!important;">333</div>
<script>
const print = () => {
window.print()
}
document.getElementById('dy').onclick = print
</script>
</body>
</html>
哪有3000mm那么高的打印?你调打印首选项的高度为你想要的高度不就不会分页了,具体是控制面板---打印机---打印机首选项,新建一个卷我们的打印机最大值支持2286的高度