我想打印页脚上的每一页,我有。页脚上方的div中的文本内容是动态的,所以我不知道它的大小。我的页脚有固定的位置,所以它会在每一页重复。我的问题是内容溢出页脚。
@media print {
@page {
size: A4;
margin: 2cm;
}
body {
position: relative;
}
html,
body {
margin: 0cm !important;
width: 210mm;
height: 100%;
}
footer {
display: inline-block;
position: fixed;
vertical-align: bottom;
width: 100%;
bottom: 0;
}
}
1条答案
按热度按时间vsmadaxz1#
CSS属性position设置为fixed的元素将通过将top或bottom设置为0来“粘”在页面的边缘。它们也将在每个打印页面上重复。