
Originally Posted by
BlindSide
Then, just add the "noprint" class to any web element that should not appear on a printout, like so:
Code:
<div class="navigation rightFloat noprint">Navigation Box</div>
Actually one of the nice things about CSS is that you don't need to edit the HTML (and thus PHP in this case) anymore. That is if classes and id's have been added at the right places.
Anyway, it's better to do it like this:
Code:
<div class="navigation rightFloat">Navigation Box</div>
Do not edit the HTML/PHP! The div already has a class so there is no need to add one (to be more precise, it already has one class to many tmho ;-) )
Instead edit the stylesheet only, and for example add:
Code:
@media print {
.navigation, . some-other-class, #an-example-id {display: none}
}
You can add classes and id's as you like. Now if you change your mind, and decide that you do want to show the contents of some-other-class after all for example, you only need to edit the CSS again:
Code:
@media print {
.navigation, #an-example-id {display: none}
}
Of course the style "display: none;" is just an example too, most styles used for display can be used for @media print as well.
Note: as far as I know you can't make visible what's within a hidden area using CSS. And backgrounds usually are not printed (depends on client settings).