2015-06-17 55 views
0

如何讓mpdf將div內容移動到下一頁而不是在中間將其分開?我發現了一些mpdf專用標籤,但它並沒有幫助我。有任何想法嗎?不要破壞div內的內容

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

回答

1

在mpdf中也有CSS屬性page-break-inside

使用

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