我必须div 一个是固定的,它是所有页面的标题 以太是内容 这是我的代码
<style>
#print-head {
display: none;
}
@media print {
#print-head {
display: block;
position: fixed;
top: 0pt;
left:0pt;
right: 0pt;
text-align: center;
}
}
</style>
<div id='print-head'>
page header herer for all page
</div>
<div id='content'>
content here coming from foreach loop
</div>
我的问题是 div 内容在第一页有很多行打印预览一切正常 标题内容看起来像这样
我需要一个代码来使内容 div 总是从顶部获得边距,而不仅仅是在第一页 我如何清除:每页中第一个 div 和第二个 div 之间的边距非常感谢
最佳答案
尝试
#print-head {
position: absolute;
top: 0px;
left:0px;
width: 100%;
text-align: center;
padding: 20px 0;
}
关于javascript - 清除正常 div 和固定 div 之间的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48526837/