我有一个 html 文件,我需要在最后一页的末尾
打印图像。我试过下面的 css 但没有用
<div>test content</div>
<div style="page-break-after:always;"></div>
<div>atestecontent</div>
<div style="position:absolute; bottom:0px;"><img src="android.png" width="63" height="91" alt="" /></div>
</div>
如何解决这个问题?
最佳答案
您需要在文档中添加打印样式表。然后你只需要重置绝对位置显示: block ;记住也要使用 absolute 将类添加到 div。
<style media="print">
.remove-abs {
position:static;
}
.page-break {
page-break-before:always;
}
</style>
<div>test content</div>
<div style="page-break-after:always;"></div>
<div>atestecontent</div>
<div class="remove-abs page-break" style="position:absolute; bottom:0px;"><img src="android.png" width="63" height="91" alt="" /></div>
</div>
关于html - 在最后一页 css 的末尾打印图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20608781/