Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在css最后一页的末尾打印图像_Html_Css - Fatal编程技术网

Html 在css最后一页的末尾打印图像

Html 在css最后一页的末尾打印图像,html,css,Html,Css,我有一个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.pn

我有一个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>

.取下abs{
位置:静态;
}
.分页符{
前分页符:始终;
}
测试内容
阿泰斯特内容物

您只想打印图像吗?没有别的吗?我想打印html文件中的所有内容以及最后一页末尾的图像。我已经尝试了你的代码。但是它打印在第一页的末尾,而不是最后一页的末尾。上面更新了,希望对你有用。如果看不到内容或页面,很难提供帮助。如果这不起作用,我建议设置一个JSFIDLE,这样我们可以更容易地提供帮助。感谢您的努力。我已经试过你的代码了。现在它被打印在内容的末尾,而不是最后一页的底部