I have some code that generates bills for multiple customers on one web page. I use the div
element style="page-break-after:always"
so the user can print every customers bill at once, and the bills for unique customers will all be printed on a separate sheet of paper. My issue is that I want the bills to be a little more readable on the users screen by putting some space between one bill and the next bill, but I don't want to print a bunch of white space. How can I introduce some extra space between the bills that the printer will ignore?
views:
51answers:
3
+3
A:
You can implement a special style sheet only for the printer and have that style ignore certain elements. Something like this would work:
<link rel="stylesheet" type="text/css" media="print" href="/css/print.css">
Then within your print.css file you can have all of your original CSS and define something like this:
.printhide{ display:none; }
Within your HTML file, all the elements you want hidden just add the printhide
class to them. Eg.
<br class="printhide">
Sam152
2010-07-25 06:08:04
Works like a charm, thanks a lot!
typoknig
2010-07-25 06:28:05
Happy to be of assistance :)
Sam152
2010-07-25 10:00:34
+2
A:
Insert a div
after the bill:
<div class="bill">
...your bill goes here...
<div class="spacer"></div>
</div>
Add a print stylesheet:
<link rel="stylesheet" href="screen.css"/>
<link rel="stylesheet" href="print.css" media="print"/>
Define the space in screen.css:
div.spacer {margin-bottom:2em;}
Hide the space in print.css:
div.spacer {display:none;}
jmz
2010-07-25 06:12:12