Dompdf默认页面标题内容重叠 [英] Dompdf default page header content overlap
问题描述
我从dompdf创建pdf时遇到小问题。在html页面标题位置:修复了内容在页面标题上的重叠。页面内容正在动态加载。如何解决内容重叠的问题。类似此链接的html版本 html
I have small problem in pdf creation from dompdf. In html page header position:fixed the content is overlaped on the header the page.the content of the page is dynamically loading.how can clear the content overlap problem.the html version like this link html
推荐答案
定位内容为当前根据主要内容容器或 body
元素放置的位置。为确保没有重叠,请在页面上添加页边距,然后将内容负向定位以将其移到正文之外( #header {position:fixed; top:-50px; left:0px; right:0px;高度:50像素;}
)。
Positioned content is currently placed according to the primary content container, or body
element. To ensure there is no overlap add a margin to the page then position your content negatively to move it outside the body (#header { position: fixed; top: -50px; left: 0px; right: 0px; height: 50px; }
).
例如:
<html>
<head>
<style>
@page { margin: 50px; }
body { background-color: #c0ccff; padding: 1em; }
#header { position: fixed; top: -50px; left: 0px; right: 0px; height: 50px; background-color: orange; padding: .5em; text-align: center; }
</style>
</head>
<body>
<div id="header">HEAD</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tempor gravida enim, id sollicitudin eros ullamcorper a. Cras vitae convallis dolor. Maecenas eget fermentum magna. Donec gravida neque vel sapien congue consequat. Nulla facilisi. Sed volutpat dui et nibh posuere, eu malesuada arcu congue. Cras vehicula elit eros, non tristique leo congue quis. Morbi aliquam scelerisque augue, eu sodales dolor. Integer a commodo nibh. </p>
<div style="page-break-before: always;"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tempor gravida enim, id sollicitudin eros ullamcorper a. Cras vitae convallis dolor. Maecenas eget fermentum magna. Donec gravida neque vel sapien congue consequat. Nulla facilisi. Sed volutpat dui et nibh posuere, eu malesuada arcu congue. Cras vehicula elit eros, non tristique leo congue quis. Morbi aliquam scelerisque augue, eu sodales dolor. Integer a commodo nibh. </p>
</body>
</html>
这篇关于Dompdf默认页面标题内容重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!