html CSS:在每个页面上打印页脚

zbdgwd5y  于 2023-08-01  发布在  其他
关注(0)|答案(1)|浏览(195)

我想打印页脚上的每一页,我有。页脚上方的div中的文本内容是动态的,所以我不知道它的大小。我的页脚有固定的位置,所以它会在每一页重复。我的问题是内容溢出页脚。

  1. @media print {
  2. @page {
  3. size: A4;
  4. margin: 2cm;
  5. }
  6. body {
  7. position: relative;
  8. }
  9. html,
  10. body {
  11. margin: 0cm !important;
  12. width: 210mm;
  13. height: 100%;
  14. }
  15. footer {
  16. display: inline-block;
  17. position: fixed;
  18. vertical-align: bottom;
  19. width: 100%;
  20. bottom: 0;
  21. }
  22. }

个字符
screenshot here

vsmadaxz

vsmadaxz1#

CSS属性position设置为fixed的元素将通过将top或bottom设置为0来“粘”在页面的边缘。它们也将在每个打印页面上重复。

相关问题