php - mpdf - 表格列高

标签 php css mpdf

我在使用 mpdf(版本 5.7.2)时遇到问题,忽略了表格列上的固定(px)高度。

引用 MPDF Manual它说它支持表格列高

都作为 html 属性 ( HTML attributes section of manual )

TD height LENGTH (but not %)

作为 css 样式 ( Supported CSS section of manual )

TD height LENGTH (but not %) (mPDF >= 4.0)

我有一个动态行数,每行有 10 <td>元素。我有一个横跨 10 列的表格行:

<tr>
  <td colspan="10" style="width: 720px; height: 232px;">
    <span>Label</span>
  </td>
</tr>

但在呈现的 pdf 中,高度只是其中内容的大小。

信息取自 MPDF Limitations页:

Block-level tags (DIV,P etc.) and lists inside table cells are only partially supported (only the 'inline' type CSS styles are applied).

我试过类似的方法:

<tr>
  <td colspan="10" style="width: 720px; height: 232px;">
    <div style="height: 232px;">
      <span>Label</span>
    </div>
  </td>
</tr>

但这也没有产生任何结果。有谁知道为什么我在列上的高度被忽略或知道实现此目的的解决方法?

最佳答案

我发现的一种修复方法是在表格列上使用 padding-bottom 而不是 height。它为我提供了列所需的高度。

<tr>
  <td colspan="10" style="width: 720px; padding-bottom: 232px;">
    <span>Label</span>
  </td>
</tr>

关于php - mpdf - 表格列高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23732388/

相关文章:

html - Li 元素符号/点太高 : how to vertically center

php - mPDF:为整页使用背景图像

php - 如何在 mpdf 中居中图像?

php - 使用滚动面板修复表头

php - 将特征图像背景链接到标题背景

php - 哪种Web应用模块化结构更好?

html - 调整窗口大小隐藏了我的部分 div 文本

css - 使 div 垂直固定但水平粘附到页面的边框

php - mPDF 以 PDF 打印为中心

php - Typeahead 输入字段和查询通过 AJAX 传递给 PHP