简体   繁体   English

打印时在最后一页底部放置一个div

[英]Place a div in the bottom of the last page when printing

i'm trying to place a footer that'll only appear at bottom of the last page.我正在尝试放置一个只会出现在最后一页底部的页脚。

.footer {
  width: 100%;
  margin-bottom: 0 !important;
  font-size: 10pt;
  page-break-inside: avoid !important;
  page-break-before: auto !important;
}

here's the div :这是 div :

      <div className="footer mt-auto grid h-16 grid-cols-2 content-center items-center justify-center bg-black ">
        <div className="col-span-1 col-start-2  text-white">
          Bla bla footer here
        </div>
        <img className="col-start-3 pl-20" src={logoIcon} alt="logo_icon" />
      </div>

I have also tried :我也试过:

body {
  position: relative;
}

.printfooter {
  position: absolute;
  bottom: 0;
}

but it doesn't work, i've also tried position sticky but it prints on every page.但它不起作用,我也尝试过粘贴位置,但它打印在每一页上。

any help appreciated任何帮助表示赞赏

 .footer { position: fixed; left: 0; bottom: 0; width: 100%; background-color: #ff5733; color: white; text-align: center;
 <div> content </div> <div class="footer"> This is footer </div>

.footer {
    clear: both;
    position: relative;
    height: 40px;
    margin-top: -40px;
}

this partially fixed the issue,in some pages it's right beside the end of the page, in some it has some margin from the bottom (even after removing margin-top:-40ps).这部分解决了这个问题,在某些页面中它位于页面末尾的旁边,在某些页面中它从底部有一些边距(即使在删除了 margin-top:-40ps 之后)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM