You are here: Re: Print without ads « HTML « IT news, forums, messages
Re: Print without ads

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация