apply a print-only style

A

Andrew Poulos

I can do something like

document.getElementById("btn").style.visibility = "hidden";

but is there a way to apply a style so that it only applies when the
page is being printed? I don't mean applying a style only while the page
is being printed and then removing the style when the page has finished
printing but, rather, the equivalent of

<style type="text/css" media="print">
#btn { visibility: hidden; }
</style>

Andrew Poulos
 
A

Andrew Poulos

Andrew said:
I can do something like

document.getElementById("btn").style.visibility = "hidden";

but is there a way to apply a style so that it only applies when the
page is being printed? I don't mean applying a style only while the page
is being printed and then removing the style when the page has finished
printing but, rather, the equivalent of

<style type="text/css" media="print">
#btn { visibility: hidden; }
</style>

Its ok, I just discovered I can do

@media print {
#btn {
visibility: hidden:
}
}

in the style sheet. I'm not in a position to add to the head of the page
in question but I could edit the javascript or the CSS it referenced.

Andrew Poulos
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top