style display:none and printing

E

Erwin Moller

Hi all,

Situation:
A (rather long) page that contains a lot of divs.
Some are visible (display:inline) at a certain time, other not.

The javascript is responsible for divs to be visible or not.


Question:
If the browser is displaying some divs, and the user gives a printcommand
for the page, can I be sure only the visible parts are printed?

On my machine this is working fine (W2000/IE6), but I hope it will work on
all setups that support display:inline and display:none (= every modern
browser I think).

Could this give problems for different printers/printdrivers?
Or can I trust that if the browser can handle divs right, it will send the
correct commands to the printer?

(My problem is that the target environment (intranet somewhere) is somewhat
diverse.)

Any advise is very welcome. :)

Regards,
Erwin Moller
 
M

Martin Honnen

Erwin Moller wrote:

A (rather long) page that contains a lot of divs.
Some are visible (display:inline) at a certain time, other not.

The javascript is responsible for divs to be visible or not.


Question:
If the browser is displaying some divs, and the user gives a printcommand
for the page, can I be sure only the visible parts are printed?

On my machine this is working fine (W2000/IE6), but I hope it will work on
all setups that support display:inline and display:none (= every modern
browser I think).

In general there could be a stylesheet or stylesheets for printing and
CSS rules for precedence and cascade should dictate whether what is
rendered on the screen is also printed that way.

And if you really need to know whether certain browsers print a document
in the state as currently manipulated with script or as initially loaded
you should run tests with those browsers.
 
B

bwucke

Erwin Moller napisal(a):
Hi all,

Situation:
A (rather long) page that contains a lot of divs.
Some are visible (display:inline) at a certain time, other not.

That's an abuse. <div> is meant to be a block element (display: block),
and if you want a generic inline, use <span>. Theoretically there's
nothing wrong with that, and if you want it's legal to create <textarea
style="display:table-header-group"> but that's asking for trouble.
If the browser is displaying some divs, and the user gives a printcommand
for the page, can I be sure only the visible parts are printed?

If not, be sure to report a bug to the browser developers.
AFAIK there should be no problems. I never tried with inline DIVs
though.
 
E

Erwin Moller

Erwin Moller napisal(a):

That's an abuse. <div> is meant to be a block element (display: block),
and if you want a generic inline, use <span>. Theoretically there's
nothing wrong with that, and if you want it's legal to create <textarea
style="display:table-header-group"> but that's asking for trouble.


If not, be sure to report a bug to the browser developers.
AFAIK there should be no problems. I never tried with inline DIVs
though.

Thanks both,

The display-style element in div is abuse?
OK, I believe that right away :).
I am confortable with JS, but my stylesheetknowledge sucks.
I'll change them to span's right away.

<textarea style="display:table-header-group">
LOL, nice nonsense. I got your point. ;-)

Ok, as far as the printerdrivers/printers/browser-combi's are concerned:
I'll hope the best of it, and just try it.
Untill now I didn't find a printer that screwed it up.

Regards,
Erwin Moller
 

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