2

I'm trying the below shown code. but still i'm getting the header and footer on printed page.

show i am tried many css element but i can't remove the header and footer

 <style type="text/css" media="print">
  @media print {
    Header {
      display: none !important;
    }
    Footer {
      display: none !important;
    }
    #lrno {
      font-size: 20pt;
      position: absolute!important;
      top: 25px;
      left: 30px;
    }
    #consignor {
      font-size: 30pt;
      position: relative;
      top: 70px;
      left: 0px;
    }
    #consignee {
      font-size: 33pt;
      position: relative;
      top: 9px;
      left: 590px;
    }
  }

</style>




<div id="lrno">
  <?php echo  $sel['lrno']; ?>
</div>
<div id="consignor">
  <?php echo  $sel['cr_name']; ?>
</div>
<div id="consignee">
  <?php echo  $sel['ce_name']; ?>
</div>
<div>
  <button class="btn btn-small red" onclick="PrintDiv()"></button>
</div>

I'm getting the footer when printing I'm getting the footer when printing

Natalie Hedström
  • 2,607
  • 3
  • 25
  • 36
Sail
  • 129
  • 1
  • 10

2 Answers2

0

As far as i know, header and footer from browser can set from browser itself. On firefox, you can access from File -> Page Setup then Margin & Header/Footer tab, then set "--blank--" on Header/Footers section.

QeiNui
  • 65
  • 1
  • 8
  • This is stackoverflow, not superuser: The question was asked from the perspective of a web developer not that of a browser user. – Quentin Dec 17 '15 at 08:13
  • Most browser did not allow web developer to control browser. – QeiNui Dec 18 '15 at 01:43
-1

add thhis class to your header and footer

this media query is working for me

@media print {
.no-print, .no-print * { display: none !important; } }

Mohamed Rihan
  • 131
  • 2
  • 15