【问题标题】:DOMPDF Strange page-break inside a divDOMPDF div中的奇怪分页符
【发布时间】:2021-11-16 20:22:28
【问题描述】:

如果我的<div> 不合适,我会遇到问题,而不是出现奇怪的分页符。 我认为这与填充有关。有人可以帮帮我吗?

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

导出示例:

【问题讨论】:

    标签: css pdf dompdf page-break-inside


    【解决方案1】:

    我找到了一个适合我的解决方案:

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

    【讨论】:

      猜你喜欢
      • 2017-08-03
      • 2016-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多