我试图让MPDF正确打印带溢出的div:hidden。我上下阅读了他们的文档并尝试了各种各样的东西。没运气。每个mpdf,具有overflow:hidden的块元素必须具有position:absolute或position:fixed set。当你只打印一个div时,这很好。当我尝试嵌套div并需要内部剪辑文本时,问题出现了。这就是我的意思:
打印出精美的
$html = <<< EOM
<div style='width:300px;height:100px;position:absolute;overflow:hidden;border:1px solid black;'>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
$html = <<< EOM
这不是
$html = <<< EOM
<div style='border:1px solid red;position:relative;'>
<div style='width:300px;height:100px;position:absolute;overflow:hidden;border:1px solid black;'>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
$html = <<< EOM
php脚本很简单
include("mpdf.php");
$mpdf=new mPDF();
$mpdf->WriteHTML($html);
$mpdf->Output();
正如您所看到的,唯一的区别是一个div在另一个div内。有没有人想出怎么做?
答案 0 :(得分:1)
在mpdf中,您无法在嵌套div上使用overflow: hidden;
。 overflow: hidden;
只能用于顶级元素。