Steven
asked on
hide html table when printing
right now i'm hiding form buttons when printing with the following css:
i would also like to hide the following:
i didn't give you everything in the above snippet, but is there a way to hide that too?
@media print {
input#DisplayAttachments {
display: none;
}
i would also like to hide the following:
<div class="dhtmlgoodies_question">Notes and Comments </div>
<div class="dhtmlgoodies_answer">
<div><table width="700" border="0" cellspacing="1" cellpadding="1">
i didn't give you everything in the above snippet, but is there a way to hide that too?
Am i missing something or is this what you are asking for
@media print {
input#DisplayAttachments {
display: none;
}
#dontprintme{display:none}
}
<div id='dontprintme'>
<div class="dhtmlgoodies_questi on">Notes and Comments </div>
<div class="dhtmlgoodies_answer ">
<div><table width="700" border="0" cellspacing="1" cellpadding="1">
</div>
@media print {
input#DisplayAttachments {
display: none;
}
#dontprintme{display:none}
}
<div id='dontprintme'>
<div class="dhtmlgoodies_questi
<div class="dhtmlgoodies_answer
<div><table width="700" border="0" cellspacing="1" cellpadding="1">
</div>
or better way
@media print {
input#DisplayAttachments , #dontprintme {
display: none;
}
<div id='dontprintme'>
<div class="dhtmlgoodies_questi on">Notes and Comments </div>
<div class="dhtmlgoodies_answer ">
<div><table width="700" border="0" cellspacing="1" cellpadding="1">
</div>
@media print {
input#DisplayAttachments , #dontprintme {
display: none;
}
<div id='dontprintme'>
<div class="dhtmlgoodies_questi
<div class="dhtmlgoodies_answer
<div><table width="700" border="0" cellspacing="1" cellpadding="1">
</div>
You are probably making the same mistake most new programmers do -- thinking if you hide the DIV that you have incorrectly wrapped around the table structure, it will hide the table. This is flawed thinking.
1. first, tables need no enclosing DIV and should not have one because of erroneous inferences that the DIV properties somehow control the table state. They do NOT.
2. Remove the DIV, as it is doing nothing but confusing you.
3. Give the TABLE an ID or NAME, and use CSS to hide it DIRECTLY, not trying to via the DIV.
4. use the display:none and display:block on the TABLE, just as you would on other HTML elements
WHen you get the DIV out of the way and hide the table directly, it will work fine. IF not, it won't work.
1. first, tables need no enclosing DIV and should not have one because of erroneous inferences that the DIV properties somehow control the table state. They do NOT.
2. Remove the DIV, as it is doing nothing but confusing you.
3. Give the TABLE an ID or NAME, and use CSS to hide it DIRECTLY, not trying to via the DIV.
4. use the display:none and display:block on the TABLE, just as you would on other HTML elements
WHen you get the DIV out of the way and hide the table directly, it will work fine. IF not, it won't work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.golivecentral.com/pages/txttut/printCSS.html