By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

style display:none and printing

P: n/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.

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
Jan 4 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a


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.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 4 '06 #2

P: n/a

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.

Jan 4 '06 #3

P: n/a
bw****@gmail.com wrote:

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.


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
Jan 5 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.