Bo's blog

Friday, July 15, 2011

print style

Use the print style to control the print content in the page, and page break.

<html>
	
<head>
	<style>
	/* Print Style Sheet */
	@media print {
		body { background:white; color:black; margin:0 }
		div {display:none;}
		.print {display:block;}
		.pageBreak { page-break-after: always }
	}
	
	div { font-weight: bold }
	</style>
</head>
<body>
<div ><a href="javascript:window.print()" rel="nofollow">Print This!</a> This is content that will not print if the user tries to print this page</div>
<div class="print">This will print because it have the class="print". Simple CSS is all it takes to setup something like this</div>
<div class="print pageBreak">This will also print</div>
<div class="print">This will also print, but in a new page</div>
<div >This will not print</div>
</body>

0 Comments:

Post a Comment

<< Home