CSS "position: fixed" does not work for print media

CSS2 (https://drafts.csswg.org/css2/visuren.html#propdef-position) defines the following behavior for "position: fixed" specifically for print media:

In the case of the print media type, the box is rendered on every page, and is fixed with respect to the page box, even if the page is seen through a viewport (in the case of a print-preview, for example).

However, this does not work in Safari at all, which means that creating a simple footer for every single page of printed output does not work. This works fine in other browsers.

Example code:

<html lang="en">
  <head>
    <title>Printed Position Bug Demo</title>
    <style type="text/css">
      .page-break {
        page-break-before: always;
      }

      .printfooter {
        display: none;
      }

      @media print {
        .printfooter {
          display: block;
          text-align: center;
          width: 100%;
          /*
          By setting the position to fixed and adding a bottom, the footer will be forced to the bottom of the page, and it is supposed to automatically
          print on every page.
          */
          position: fixed;
          bottom: 42px;
        }
        
        button {
          display: none;
        }
      }
    </style>
  </head>
  <body>
    <div class="printfooter">This is a footer for the bottom of every printed page.</div>
    <div>Page 1 content</div>
    <div class="page-break">Page 2 content</div>
    <div class="page-break">Page 3 content</div>
    <br>
    <button onclick="window.print();">Open print dialog</button>
  </body>
</html>

The outcome should be that one the screen, it shows

Page 1 content
Page 2 content
Page 3 content

(button) Open print dialog

And when printed, 3 pages should appear each with their corresponding "Page X content" and the same footer in the bottom center of every page.


How do I file a bug report with Apple so that something so basic and rudimentary gets fixed in their browser?

Posted on Dec 9, 2019 4:34 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 9, 2019 7:48 PM

cwillwer Said:

"[...]CSS "position: fixed" does not work for print media: How do I file a bug report with Apple so that something so basic and rudimentary gets fixed in their browser?"

-------


Provide this a Feedback to Apple:

You can report this as a bug, using the Safari Feedback Page:

  1. Go Here: Feedback - Safari - Apple
  2. Select: "Bug Report" for the "Feedback Type"
  3. Proceed from there as Necessary.

Similar questions

2 replies
Question marked as Top-ranking reply

Dec 9, 2019 7:48 PM in response to cwillwer

cwillwer Said:

"[...]CSS "position: fixed" does not work for print media: How do I file a bug report with Apple so that something so basic and rudimentary gets fixed in their browser?"

-------


Provide this a Feedback to Apple:

You can report this as a bug, using the Safari Feedback Page:

  1. Go Here: Feedback - Safari - Apple
  2. Select: "Bug Report" for the "Feedback Type"
  3. Proceed from there as Necessary.

Dec 9, 2019 7:58 PM in response to cwillwer

cwillwer Said:

"CSS "position: fixed" does not work for print media: [...] However, this does not work in Safari at all, which means that creating a simple footer for every single page of printed output does not work. This works fine in other browsers[...]."

-------


Reset your History and Cache:

I am curious as to whether or not the Cache is what is getting in the why here. So...


Try This: Clear Your Temporary Internet Files (History and Cache)

  • The History: remembers previously entered data.
  • The Cache: remembers what a Web site appeared as, the last time you it was visited.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

CSS "position: fixed" does not work for print media

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.