locked
Any clever way to get rid of URL at top and bottom of a page? RRS feed

  • Question

  • User1216627406 posted

    I have a one page document that when printed, has both header and URL at bottom of page.
    I googled and discovered I could use the following CSS to get rid of the URL at head and bottom of page.

    <style type="text/css" media="print">
     @page
     {
     size:  auto;   /* auto is the initial value */
     margin: 0;  /* this affects the margin in the printer settings */
     }
    
    html
     {
     background-color: #FFFFFF;
     margin: 0;  /* this affects the margin on the html before sending to printer */
     }
    
    body
     {
     border: solid 0px blue ;
     margin: 10mm 15mm 10mm 15mm; /* margin you want for the content */
     }
     </style>
    

    However, the only way it works is if I set the printer to use "actual" instead "fit page" options.


    The page uses <TABLE> properties.

    Am I missing something?

    Thanks in advance

    Wednesday, May 2, 2018 4:15 PM

All replies

  • User753101303 posted

    Hi,

    It is appended by the browser when printing a page depending on user controlled settings. Try maybe https://developer.mozilla.org/en-US/docs/Web/CSS/%40page/size to force a page size and see if it makes a difference ?

    It tend myself to avoid this kind of clever hacks or at least to not apply them first as you'll likely always run into some corner case (it works for all users, if you plan to print multiple pages it still works in this situation ?)

    My default approach would be to have a link on my printing page to inform users about how to use the printing dialog to get rid of headers and  footers...

    Wednesday, May 2, 2018 5:22 PM