2

I have a "Print" button in my web page (php html) and I don't want it to print along with my data. Can I do it with CSS? Is there another way?

VolkerK
  • 95,432
  • 20
  • 163
  • 226
CMartins
  • 3,247
  • 5
  • 38
  • 53

3 Answers3

3

Yes you can with CSS, although support will only be with browsers that support CSS3.

But its simple:

 @media print {
    …
 }
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291
1

assign an id(buttonId) to the button eg: id="buttonId" and then in css:

#buttonId
{
    display:none;
}

<link rel="stylesheet" href="print.css" type="text/css" media="print" />

just use the above css file for the same.

1

Just create multiple style sheets

<style type="text/css" media="all"> @import "nucss2.css";</style>
<link rel="stylesheet" type="text/css" media="print" href="print.css" />

And look at the

media="print"

Jordy van Eijk
  • 2,718
  • 2
  • 19
  • 37