gpt4 book ai didi

php - mpdf - 表格列高

转载 作者:行者123 更新时间:2023-11-28 17:43:11 24 4
gpt4 key购买 nike

我在使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com