Printing a page with out header and footer

by Michael Eugene Yuen

HTML

<h1 style="text-align: center;">Test Page</h1>
<a href="http://facebook.com">facebook</a>
<button id="print">Print</button>

CSS

@media print {
  #print {
    display: none;
  }

  a[href]:after {
  content: none !important;
  }

  @page {
    size: A4;
    margin: 0;
    padding: 0;
  }
}

JavaScript

$('#print').on('click', function(){
	window.print();
});