Solved

hide html table when printing

Posted on 2010-11-18
5
457 Views
Last Modified: 2012-05-10
right now i'm hiding form buttons when printing with the following css:
@media print {
input#DisplayAttachments {
display: none;
}

Open in new window


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">

Open in new window


i didn't give you everything in the above snippet, but is there a way to hide that too?
0
Comment
Question by:sknoll84
  • 3
5 Comments
 
LVL 10

Expert Comment

by:stu215
ID: 34168640
0
 
LVL 14

Expert Comment

by:ali_kayahan
ID: 34168977
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_question">Notes and Comments </div>
<div class="dhtmlgoodies_answer">
      <div><table width="700" border="0" cellspacing="1" cellpadding="1">
</div>
0
 
LVL 14

Expert Comment

by:ali_kayahan
ID: 34168988
or better way

@media print {
input#DisplayAttachments , #dontprintme {
display: none;
}

<div id='dontprintme'>
<div class="dhtmlgoodies_question">Notes and Comments </div>
<div class="dhtmlgoodies_answer">
      <div><table width="700" border="0" cellspacing="1" cellpadding="1">
</div>
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 34169764
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.
0
 
LVL 14

Accepted Solution

by:
ali_kayahan earned 500 total points
ID: 34169972
Wrapping the contents that you dont want to display in a class like .hideMe and appending that to your css like ;

@media print {
input#DisplayAttachments , .hideme{
display: none;
}

Open in new window


would be enough
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
advertisement module in core php 4 92
WEB Farm 6 26
razorCMS: Change Menu Font 4 27
while loop in html mail format 5 33
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now