DOMPDF Strange page-break inside a div

614 Views Asked by At

I have a problem if my <div> doesn't fit, than i got an strange page break. I think it's something with the padding. Can someone help me out?

HTML:

<div class="info">
      <h2 class="font--xxl margin--m">Creatable checkboxes tooltip</h2>
      <p class="font--m margin--m">Lorem creatable checkbox lorem</p>
</div>

CSS:

.info {
  width: 570px;

  padding: 32px 48px 40px;
  border-radius: 8px;
  margin-top: 24px;

  color: #000;
  background: #d9ebf7;

  page-break-inside: avoid;
}

Example of export:

enter image description here

1

There are 1 best solutions below

0
Gurdt On

I found an solution what works for me:

.info {
  page-break-inside: avoid !important;
}

.info > *:first-child {
  page-break-before: avoid !important;
}

.info > *:last-child {
    page-break-after: avoid !important;
}