go top

MEGA Sale

  • Colection of 65 PHP scripts for $4.29 each

Get 65 PHP scripts in a bundle for $4.29 each!

View Offer

Create a Print Stylesheet

Monday, 21st January, 2013  /  HTML / CSS Tutorials  /  1 Comments
Have you ever looked at what your website looks like printed out? Right now go look at a preview of your website. Does your website look terrible in print preview? It most likely does if you do not have a css stylesheet custom made for printing. Often, we have ads or or flashy things that we really would not want printed out. We want our print outs to look professional almost like a printed advertisement to anyone who sees them. Think about it... Whenever someone prints out your webpage, it is a good possibility others will see it. This is an excellent chance for you to beat out your competition with offline marketing. Let's start by telling the browsers where they can find our print stylesheet.

<link href='http://www.afterhoursprogramming.com/styles/print.css' rel='stylesheet' type='text/css' media="print"/>


Of course, this is the one on my website, but you should change the "href" attribute to point to your new print.css. The important thing to notice is the "media" attribute that is set to "print" instead of screen. Once, a browser sees that you have a print stylesheet, any time the user decides to print, the browser renders the new page according to the new print stylesheet. You should place this tag in the head section of your web page to ensure that it is rendered immediately.

Basically, your print stylesheet will probably contain mostly classes that have "display:none;" properties. The idea is to hide the irrelevant flashy stuff on your website, and only show the useful and relevant information. Part of my print.css contains css stylesheet like:

.sidebar-container {
display: none;
}


When users print out my website, I do not want them to show everyone my navigation. I want to create my big endorsement at the top, and give them the raw text they want on the rest of the page. I know we have grown up in the electronic atmosphere, but people do print things and they print a whole lot. So, you should definitely consider adding a print stylesheet to your pages.
Share on:

1 Comments to "Create a Print Stylesheet"

Chris

Chris / November 10, 2015 at 19:42 pm

Today's date :

 echo date("Y-m-d"); 

Add your comment

Captcha

    Please, be polite and helpful and do not spam or offend others! We promise you will be treated the same way!

    Log in to your account to post your comments. If you still haven't joined our community yet, you can create your FREE account now!

    Posting tip:
    If you use code in your comments, please put it in these tags [php], [sql], [css], [js] PHP code example: [php] echo date("Y-m-d"); [/php]

    Thank you,
    PHPJabbers Team

    PHP Scripts

    Check our extensive collection of top-notch PHP Scripts that will enhance your website!


    Commercial PHP scripts

    Free Web Templates

    Browse our FREE Website Templates and use them to create your new sweeping website!

    Free website templates