gpt4 book ai didi

html - 不要破坏 div 中的内容

转载 作者:太空宇宙 更新时间:2023-11-04 11:47:16 25 4
gpt4 key购买 nike

我如何告诉 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>

最佳答案

有 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>

关于html - 不要破坏 div 中的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30897236/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com