CSS Print styles with dynamic content

Hi,I have a site that is using PHP. I have already created a Print.css document that has different styles for printing the pages. I have run into a problem when I have buttons or images that are being pulled in dynamically using PHP that I dont want visible when the user prints. I have buttons I also dont want to be displayed that are dynamiclally pulled into the page. I want BackBTN_R.gif to not be displayed when they go to print. How can I write the CSS to do this? Thanks!

if you are using PHP to output your content, then output the content you want hidden with a class attached to it

because, BackBTN_R.gif has to be attached to some HTML element to be displayed, so just make PHP output this:

<img src=“images/BackBTN_R.gif” class=“hide_print”/>

and then in your CSS you just do

.hide_print { display: none; }

you could also apply this class to every element on the page you want hidden instead of referencing them specifically by ID, the way you are doing now.

Which would effectively make your print.css one definition

If I add that in it makes my whole page not work.

"

wrong place, you put it in the javascript…

you need to put the class="hide_print" on the <img /> tag so that after your php finishes spitting out all your code, your HTML for that image should read:


<img src="images/BackBTN_R.gif" class="hide_print" />

perfect, thank you so much!!!

no prob… :thumb2:

Yay TeamWork!!! :fab: