title: DOMPDF - Can't get page-break-inside to work
body: <p>I have a really simple page that displays a number of sections.  Each section has a header and then some bullets.  I'd like to make it so that if an entire section cannot fit on the page then it moves to the next page.</p>
  
  <p>To achieve this I have wrapped each section in a div element like so ..</p>
  
  <pre><code>&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;
  </code></pre>
  
  <p>The result that I get is that the bullets do not break inside (which is good) however the section header does not stay with the bullets (which is bad).</p>
  
  <p>Any help that can be provided would be very appreciated.</p>
  
  <p>Here is the PHP code I'm using:</p>
  
  <pre><code>$html = "&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;";
  $result = mysql_query("SELECT comment from comments");
  while ($row = mysql_fetch_array($result)) { 
      $html .= "&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;\n";
      $html .= $row['comment'] . "\n";
      $html .= "&lt;/div&gt;\n";
  }
  $html .= "\n&lt;/body&gt;&lt;/html&gt;";
  
  $dompdf = new DOMPDF();
  $dompdf-&gt;load_html($html);
  $dompdf-&gt;render();
  $output = $dompdf-&gt;output();
  $dompdf-&gt;stream("$filename.pdf");
  </code></pre>
  
  <p>Here is the HTML that is generated:</p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;BID VALIDITY:&lt;br&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;This ACME Painting proposal is valid until ------&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;ENGINEERING NOTES:&lt;/span&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;Vessel to be designed to include 100% Radiography of Long &amp;amp; Girth seams per ASME prior to PWHT&lt;/li&gt;&lt;li&gt;All back gouge / root welds shall undergo MPT (Magnetic Particle Testing)&lt;/li&gt;&lt;li&gt;All external welds shall undergo MPT after fabrication&lt;/li&gt;&lt;li&gt;All nozzles subject to 100% ultrasonic inspection, Cat. D joints.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;HEALTH &amp;amp; SAFETY:&lt;br&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;The goal of this project is to treat safety and welfare of each employee as the number one priority.&lt;/li&gt;&lt;li&gt;Project target is ZERO recordable injuries.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;OVERTIME RATES FOR EXPEDITED DELIVERY:&lt;br&gt;&lt;br&gt;Premium - Time + One Half&lt;br&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Time and one half hour pay shall be for all hours Monday - Friday (Day Shift) when employee exceeds 8.5 hours in one day.&lt;br&gt;&lt;/li&gt;&lt;li&gt;Time and one half hour pay shall be paid for the first two hours beyond 8.5 hours.&lt;/li&gt;&lt;li&gt;Rate:&amp;nbsp; $60/hr (CDN)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Premium - Double Time&lt;/span&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;Double time pay shall be for all hours Monday - Friday (Day Shift) when employee exceeds 10.5 hours in one day.&lt;/li&gt;&lt;li&gt;Double time pay shall be for all hours Monday - Thursday (Night Shift) when employee exceeds 10 hours in one day.&lt;/li&gt;&lt;li&gt;Double time pay shall be for all weekend hours Saturday - Sunday (Day Shift).&lt;/li&gt;&lt;li&gt;Double time pay shall be for all weekend hours Friday - Sunday (Night Shift).&lt;br&gt;&lt;/li&gt;&lt;li&gt;Rate:&amp;nbsp; $100/hr (CDN)&lt;/li&gt;&lt;/ul&gt;&lt;br&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;DRAWING AND DOCUMENT DELIVERY:&lt;br&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Drawing and Engineering documents to be submitted starting in 2-3 weeks after receipt of order.&lt;br&gt;&lt;/li&gt;&lt;li&gt;Welding and NDE procedures and related shall be submitted 2-3 weeks after receipt of order.&lt;br&gt;&lt;/li&gt;&lt;li&gt;Drawings and Engineering documents shall be returned to HWE 7 working days after submission.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;FABRICATION DELIVERY:&lt;br&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Final fabrication will ship 10-12 weeks after receipt of Major Material and Fully Approved Drawings&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;ENGINEERING NOTES:&lt;/span&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;Vessel to be designed to include 100% Radiography of Long &amp;amp; Girth seams per ASME prior to PWHT&lt;/li&gt;&lt;li&gt;All back gouge / root welds shall undergo MPT (Magnetic Particle Testing)&lt;/li&gt;&lt;li&gt;All external welds shall undergo MPT after fabrication&lt;/li&gt;&lt;li&gt;All nozzles subject to 100% ultrasonic inspection, Cat. D joints.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;DELIVERY NOTES:&lt;/span&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;Material delivery subject to review of Mill lead time and confirmation of delivery at time of order entry at Mill&lt;/li&gt;&lt;li&gt;ACME Painting Enterprises Limited will not accept responsibility or liquidated damages / contractual impact for delays at Mill or by Origin Material manufacturer&lt;/li&gt;&lt;li&gt;Fabrication and Delivery subject to review of shop loading at time of order&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;DRAWING AND DOCUMENT DELIVERY:&lt;br&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Drawing and Engineering documents to be submitted starting in 2-3 weeks after receipt of order.&lt;br&gt;&lt;/li&gt;&lt;li&gt;Welding and NDE procedures and related shall be submitted 2-3 weeks after receipt of order.&lt;br&gt;&lt;/li&gt;&lt;li&gt;Drawings and Engineering documents shall be returned to HWE 7 working days after submission.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;FABRICATION DELIVERY:&lt;br&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Final fabrication will ship 10-12 weeks after receipt of Major Material and Fully Approved Drawings&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;ENGINEERING NOTES:&lt;/span&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;Vessel to be designed to include 100% Radiography of Long &amp;amp; Girth seams per ASME prior to PWHT&lt;/li&gt;&lt;li&gt;All back gouge / root welds shall undergo MPT (Magnetic Particle Testing)&lt;/li&gt;&lt;li&gt;All external welds shall undergo MPT after fabrication&lt;/li&gt;&lt;li&gt;All nozzles subject to 100% ultrasonic inspection, Cat. D joints.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;DELIVERY NOTES:&lt;/span&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;Material delivery subject to review of Mill lead time and confirmation of delivery at time of order entry at Mill&lt;/li&gt;&lt;li&gt;ACME Painting Enterprises Limited will not accept responsibility or liquidated damages / contractual impact for delays at Mill or by Origin Material manufacturer&lt;/li&gt;&lt;li&gt;Fabrication and Delivery subject to review of shop loading at time of order&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'&gt;&lt;span style="font-weight: bold;"&gt;ENGINEERING NOTES:&lt;/span&gt;&lt;br&gt;&lt;ul&gt;&lt;li&gt;Vessel to be designed to include 100% Radiography of Long &amp;amp; Girth seams per ASME prior to PWHT&lt;/li&gt;&lt;li&gt;All back gouge / root welds shall undergo MPT (Magnetic Particle Testing)&lt;/li&gt;&lt;li&gt;All external welds shall undergo MPT after fabrication&lt;/li&gt;&lt;li&gt;All nozzles subject to 100% ultrasonic inspection, Cat. D joints.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Lastly, I have included a screen shot of the resulting page break ...</p>
  
  <p><img src="https://i.stack.imgur.com/DrfpO.jpg" alt="Page Break Screen Shot"></p>