Skip to content

Instantly share code, notes, and snippets.

@damc-dev
Last active August 29, 2015 14:01
Show Gist options
  • Save damc-dev/399fc5c1b0298be2850f to your computer and use it in GitHub Desktop.
Save damc-dev/399fc5c1b0298be2850f to your computer and use it in GitHub Desktop.
Resources to help you make printer friendly HTML pages with CSS and JavaScript

#Printer Friendly Webpage Tips

####Resources to help you make printer friendly HTML pages with CSS and JavaScript

Simple Print Button

<form>
  <input type="button" value="Print" onclick="window.print()" />
</form>

Print Formatting with CSS

Show A Print Preview

Printer Friendly Pages with JavaScript

Print Part of a Page with jQuery

Stylesheet for printing

<link rel="stylesheet" type="text/css" href="print.css" media="print" />

Hide Elements on Print

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

Print in Landscape

@media print
{
  @page { size:landscape }
}
<style type="text/css" media="print">
    .page
    {
     -webkit-transform: rotate(-90deg); -moz-transform:rotate(-90deg);
     filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment