Optimizing your site for printing

andy - 31 Jan, 2016 3093 Views 0 Comment

The easy way to optimize your site for printing is to create a separated external css targeting a media to print only. When a printing action is being executed, the browser will send over the information from your page to the printer. It will also check if there is any specific style sheet that will be used for printing mode only. If there is, it will then render the page content using the media print css file. Therefore the page you see in the printer paper may completely looks different with the one you see in a page. The idea of optimizing in here is to hide unnecessary content.

For your readers the most important part of the page they print may be only the actual site content like news only. The other information like advertisement, banners or site menus may not be important for them. In this case you can create a class that will only be used for printing only.

In order to achieve this, you will need to specify an external css file and adding the type media to print.

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

Inside your css file you can create a css file that specify which part of your site content, you do not want to print. For example, let says we have the following html page content.

<!DOCTYPE html>
		Navigation menu in here.
		Header content in here.
		Article content in here.
		Footer content in here.

If we see above html code, the readers probably care about the article content, the rest can be hidden by using our css below. Note, if you have a partially content you do not want to be printed, you can add a class no-print to wrap the content you do not want to print.

#nav, #header, #footer, .no-print{


There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.

Related Articles

How to style pagination links with CSS?

Do you need to create a beautiful, simple and elegant pagination links with css? Simply follow our easy and quick tutorial on how to create the pagination links easily with CSS.