如何告诉mpdf将div内容移到下一页而不是在中间打破它?我发现了一些特定于mpdf的标签,但它对我没有帮助。有什么想法吗?
<div> <!-- content inside div should not be broken -->
<h1>Heading</h1>
<ul>
<li n:foreach="$teacherSummary as $teacher => $children">
{$teacher}: {array_unique($children)|implode:', '}
</li>
</ul>
<p><strong>{$event->note}</strong></p>
</div>
答案 0 :(得分:1)
CSS属性page-break-inside
也适用于mpdf。
<强>用法强>:
<div style="page-break-inside:avoid !important;">
<h1>Heading</h1>
<ul>
<li n:foreach="$teacherSummary as $teacher => $children">
{$teacher}: {array_unique($children)|implode:', '}
</li>
</ul>
<p><strong>{$event->note}</strong></p>
</div>