使用html2pdf居中对齐,两边都有行

问题描述 投票:1回答:2
<table style="width: 100%;">
        <tr>
            <td style="text-align: center;width=100%;"><h4>Education</h4></td>
        </tr>
</table>

这是我正在使用的代码。现在我想要这样的o / p:

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS95NUtkSS5wbmcifQ==” alt =“在此处输入图像描述”>“ >>

如何绘制这些水平线?

[[[[[Education这是...

如果将http://fiddle.jshell.net/4QskF/show/light/粘贴到html2pdf主页上的“输入您选择的URL”框中,则会得到PDF格式的输出,类似于您的图片。
我使用了此HTML / CSS:

<div style="border-bottom: 1px solid #000"></div> <h4 style="width:200px; margin:-10px auto 0 auto; text-align:center; background:#fff">Education</h4>

它可能需要一些调整,以便您可以在文档中实际使用它,但是我认为这个想法可行。

<table style="width: 100%; padding-top:-10px;"> <tr> <td style="text-align: center;width=33%;"><hr style="height: .3mm; background: #000; "></td> <td style="text-align: center;width=33%; padding-top:-5px;"> <h4>Education</h4> </td> <td style="text-align: center;width=33%;"><hr style="height: .3mm; background: #000; "> </td> </tr> </table>
这解决了我的问题。

php html2pdf
2个回答
3
投票

2
投票

0
投票

Works:

<td > <div style="text-align: center">Some text</div> </td>

无效:

<td style="text-align: center"> <div>Some text</div> </td>

© www.soinside.com 2019 - 2024. All rights reserved.