Css 如何让我的正文内容从上面一点开始?
我正在尝试使用Dompdf生成pdf。我有以下脚本用于设计生成的pdfCss 如何让我的正文内容从上面一点开始?,css,dompdf,Css,Dompdf,我正在尝试使用Dompdf生成pdf。我有以下脚本用于设计生成的pdf <html> <head> <style> @page { margin: 180px 50px; } #header { position: fixed; left: 0px; top: -180px; right: 0px; height: 120px; background-color: orange; text-align: center; } #footer { positio
<html>
<head>
<style>
@page { margin: 180px 50px; }
#header { position: fixed; left: 0px; top: -180px; right: 0px; height: 120px; background-color: orange; text-align: center; }
#footer { position: fixed; left: 0px; bottom: -180px; right: 0px; height: 150px; background-color: lightblue; }
#footer .page:after { content: counter(page, upper-roman); }
</style>
<body>
<div id=\"header\">
<h1>Charlie Sheen</h1>
</div>
Hi, This is Charlie Sheen <br>
<p> Winning </p>
<p> Winning </p>
<p> Winning </p>
<p> Winning </p>
<p> Winning </p>
<p> Winning </p>
<p> Winning </p>
<div id=\"footer\">
<p class=\"page\">Page </p>
</div>
<div id=\"content\">
<p>the first page</p>
<p style=\"page-break-before: always;\">the second page</p>
</div>
</body>
</html>
你能帮我把内容从上面一点开始吗
提前感谢:更改内容的边距不会产生任何影响,因为内容位于页面下方 我会考虑用P标签包装第一个句子,比如
您好,我是Charlie Sheen您正在用@page{margin:180px 50px;}从文档的顶部和底部以180px的速度推动正文。但是,收割台的高度仅为120px。因此,在标题和正文内容之间自然会有60像素的空间。您应该增加页眉的大小或减少@page页边距
您的原始代码已清理一点。您好,谢谢您的回复。我试过了你好,我是Charlie Sheen,但还是不走运。我还尝试从标题div下面删除文本,并将其放入内容div中。。但它也不起作用。你能告诉我怎么解决这个问题吗?
#content { position: fixed; margin-top: 0px;}
<html>
<head>
<style>
@page { margin: 120px 50px; }
#header { position: fixed; left: 0px; top: -120px; right: 0px; height: 120px; background-color: orange; text-align: center; }
#footer { position: fixed; left: 0px; bottom: -120px; right: 0px; height: 150px; background-color: lightblue; }
#footer .page:after { content: counter(page, upper-roman); }
</style>
<body>
<div id="header">
<h1>Charlie Sheen</h1>
</div>
<div id="footer">
<p class="page">Page </p>
</div>
<div id="content">
<p>Winning!</p>
<p style="page-break-before: always;">Winning!</p>
</div>
</body>
</html>