0

a few months ago I was able to show page numbers when printing HTML documents in the browser (firefox) with the following code:

<html>
  <head>
    <style type="text/css">
        body {
          width: 300px;
          counter-reset: page;
        }

        #header {
          border: 1px solid;
          overflow: hidden;
        }

        #header>div {
          float: left;
          width: 50%;
          line-height: 100px;
          text-align: center;
        }

        #foot {
          border: 1px solid;
        }

        #header p {
          margin: 0;
        }

        #header #pagenum {
          border-left: 1px solid;
          width: calc(50% - 1px);
        }

        @media print {
          .pageBreak {
            page-break-before: always;
            padding-bottom: 120px;
          }
          #content {
            padding-top: 120px;
          }
          #header {
            display: block;
            position: fixed;
            top: 0pt;
            left: 0pt;
            right: 0pt;
          }
          .pagenum:after {
            content: "Page " counter(page);
            counter-increment: page;
          }
          #foot {
            display: block;
            position: fixed;
            bottom: 0pt;
          }
        }

        @media screen, handheld {
          #header {
            display: none;
          }
          #foot {
            display: none;
          }
        }
    </style>
  </head>
  <body>
    <div id="header">
      <div id="headertitle">
        <p>Header</p>
      </div>
      <div class="pagenum"></div>
    </div>

    <div id="content">
      This is the page 1
      <div class="pageBreak"></div>
      This is the page 2
      <div class="pageBreak"></div>
      This is the page 3
      <div class="pageBreak"></div>
      This is the page 4
      <div class="pageBreak"></div>
    </div>

    <div id="foot">
      Foot Notes
    </div>
  </body>
</html>

That works in firefox portable 45.7.0. Since a few months after the last firefox updates it is not working anymore. I use currently firefox quantum 69.0. My question: 1. is it no longer supported? 2. How can I show correct page numbers on every page when printing html documents?

Best regards

s-max
  • 1
  • 1
  • Possible duplicate of [Print page numbers on pages when printing html](https://stackoverflow.com/questions/20050939/print-page-numbers-on-pages-when-printing-html) – Sumit Patel Sep 05 '19 at 09:53
  • Possible duplicate of [Browser Support for CSS Page Numbers](https://stackoverflow.com/questions/15797161/browser-support-for-css-page-numbers) – Lalji Tadhani Sep 05 '19 at 10:03
  • 3
    Yes, possible duplicate. But no possible solution work for me. I need any statement for my question... Is this no more supported and will be no more supported by all browsers, or is this still possible and please how... – s-max Sep 05 '19 at 10:26

0 Answers0