Posted by asdf on 05/30/07 21:26
"Mike S." <littleboyblu87@yahoo.com> wrote in message
news:1180502474.289805.174760@o5g2000hsb.googlegroups.com...
> My website is a free one that places ads on the top of the web page.
> Is there a way to provide a print option so that users can print the
> pages without the ads?
>
Yes.
Create a CSS stylesheet thus in the <head> section (or put in a separate CSS
file if you so desire) thus:
<style type="text/css" media="print">
<!--
..noprint {
display: none;
}
-->
</style>
Note 'media="print" attribute of the style tag. This is what allows you to
reformat your stuff for printing.
Give the ad (assuming it's an image) a classname like 'noprint' thus:
<img src='blah' alt='An ad.' class='noprint'>
You can extend this to remove lots of other stuff from your printout like
menus etc.... just wrap the stuff you don't want printed with a div of class
'noprint'.
Be warned... I haven't tried this on crusty browsers, but it works with
current releases of IE, FF and Opera.
Navigation:
[Reply to this message]
|