我有这个页眉/页脚,但问题是我正在使用的从 html 到 pdf 的转换不支持表格内的样式(即 mpdf)。我想使用 div 包装页眉和页脚,但我对这一切都是陌生的,不确定如何准确地做到这一点。
这是标题部分
<table width='100%' class='print_only_wrapper'>
<thead class='print_only_header'>
<tr>
<td align='"($centered?"center":"right")."'class='print_only_wrapper'> The header </td>
</tr></thead>
<tbody><tr><td>
"content goes here"
这是页 footer 分
</td></tr></tbody>
<tfoot class='print_only_footer'>
<tr>
<td align='".($centered?"center":"right")."'> footer text </td>
</tr>
</tfoot>
</table>"
最佳答案
答案在这里
CSS
body
{
margin: 0;
}
#header
{
width: 100%;
background: #333333;
height: 70px;
color: #FFFFFF;
}
#container
{
color: #000000;
height: 350px; // later you can change this height;
}
#footer
{
width: 100%;
background: #333333;
height: 70px;
color: #FFFFFF;
}
HTML
<div id="header">
header
</div>
<div id="container">
container
</div>
<div id="footer">
footer
</div>
关于php - 如何使用 div 而不是表格创建页眉和页脚? PHP, HTML, CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21397135/