Print section using Style or Css

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css" media="screen">
html, body {
margin:0;
padding:0;
}
div {
border:1px solid #000;
margin:10px;
padding:3px;
}
</style>
<style type="text/css" media="print">
html, body {
margin:0;
padding:0;
}
div {
border:0;
margin:10px 0;
padding:0;
}
.noprint {
display:none;
}
</style>
</head>

<body>
<div class="noprint">This is content that will not print if the user tries to print this page</div>
<div>This will print because it does not have the class="noprint". Simple CSS is all it takes to setup something like this</div>
<div>This will also print</div>
<div class="noprint">This will not print</div>
</body>
</html>