Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print media stylesheet and hiding elements in a printed page

Status
Not open for further replies.

jimoblak

Instructor
Oct 23, 2001
3,620
US
I stumbled on to a site the other day that displayed a nice graphic interface onscreen but printed plain text to the printer. While many sites offer a 'print this page' link to another page with no graphics or advertisements, this site used CSS to create two different media versions of a single HTML page: one for 'screen' viewing and one for 'print'. I am now developing a site with this same method but I forgot the location of the site that inspired me.

I have successfully created the CSS for basic elements like A HREFs (links are underlined onscreen but print without decoration) but I would like to hide a particular table from the printed version of my page. The table includes text and graphics so I need to find a trick to hide the entire table (but not all tables on the page). Is there a specific CSS command that can pull this off?

 
<style media=&quot;screen&quot;>
//put your on screen style here
.showSometimes {display: block;}
</style>

<style media=&quot;print&quot;>
//put your print style here
.showSometimes {display: none;}
</style>

<table class=&quot;showSometimes&quot;> Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top