just started playing around with CSS and find I have a weird little problem related to printing and hidden divs.

a page contains hidden divs (hidden on screen) - the page uses a print css file so that these divs will be printed when the page prints

there are also links to toggle these divs on/off in the screen display (the links are simple JS setting of the divs' display style)

so far so go - works fine

problem is that, if such div is opened and closed using the links, the (now re-hidden) div will no longer print when the page is printed. They will, of course, print if they are visible on the screen but will not print when hidden by the links.

example: oops - I removed this link because it was to a page on my site which seems against the rules?? yes?

I'm guessing this is related to when stylesheets are applied (as page loads) and I guess I could add a "Print" link or button that would be sure to set the display when printing - but I sort of hate that as a solution??

Any ideas or pointers? Thanks

just as a quick followup in case this helps someone else - I fixed the problem by adding !important to the print.css clases.

I have three DIV tag in a web page and have hidden by JavaScript. I want to have all the three DIV content to be printed with a single print button.

You can post links to pages showing the problem, or pages showing what you want to do.

You can't post links to attract people to your website.

You can post links to pages showing the problem, or pages showing what you want to do.

You can't post links to attract people to your website.

I am trying to create the website using this sample website.
http://tutorials.mezane.org/tabbed-navigation-using-css/

It has three DIV and using Javascript two DIV's would be hidden. The final output would be like tabbed window.

I need a print button in the page, and clicking on it should open a new wepage with all the three DIV contents displayed. So that while printing that webpage, will print all the contents of the three tabs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.