How to use @media print in an .asp script

J

Jeremy

I have a script print.asp that grabs text from webpages in printer friendly
form.

I need to put in a header that will show on the screen output of the script,
but not on the printed output.

The statement I have written is:

response.write "<p align='right' ><font size='2' face='verdana'>Use Print
Setup in your browser menu to set the margins of your printed text. Use
Print Preview to check the results before you print. This tip will not be
show in your printed output, or in Print Preview.</p>

I know I need to add an inline @media print {display:none} type of command,
but I can't get the syntax right.

Can someone please tell me how to do this? Thanks!
 
P

p c

Add it to your external stylesheet like this

@media Print
{
BODY {
DIV#navbar {
DISPLAY: none
}
..noprint {
DISPLAY: none
}
}


Then make sure you link to the external stylesheet on the pages where
you want to use the stylesheet.

Then add the style attribute CLASS="noprint" to the HTML element you
don/t want to print. For example, to prevent a table from printing, the
tag would look like this:

<table class="noprint" >

I use top and bottom shared borders for navigation links. This process
prevents the content area of the nav links from printing--and no need to
create a "print friendly" page or add Click here for print friendly page
link.

...PC
 
M

Murray

That's inline?

--
Murray
============

p c said:
Add it to your external stylesheet like this

@media Print
{
BODY {
DIV#navbar {
DISPLAY: none
}
.noprint {
DISPLAY: none
}
}


Then make sure you link to the external stylesheet on the pages where you
want to use the stylesheet.

Then add the style attribute CLASS="noprint" to the HTML element you don/t
want to print. For example, to prevent a table from printing, the tag
would look like this:

<table class="noprint" >

I use top and bottom shared borders for navigation links. This process
prevents the content area of the nav links from printing--and no need to
create a "print friendly" page or add Click here for print friendly page
link.

..PC
 
P

p c

Didn't say it's inline, Murray. I offered a suggestion how to accomplish
the desired outcome. It's possible we have different understanding of
the terms.

This is what I call inline
<p style="background: blue; color: white;">A new background and font
color with inline CSS</p>

This is what I call external (most common method, there are others ways,
too)
<head>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>


This is what I call internal:
<head>
<style type="text/css">
</style>
</head>


...PC
 
M

Murray

Your definitions and mine are the same.

I only asked because the OP specifically requested an inline solution, no?
 
P

p c

We are in agreement,Murray. And you are right as usual--no explanations
are necessary. I didn't mind the your question.

It's my personal style to answering questions seeking solutions: offer
answers that answer the poster's problem, offer insights or offer
alternatives--not necessarily answer THE question asked. Sometimes my
answer is a question. And occasionally is off the wall!

...PC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top