?
Solved

hide html table when printing

Posted on 2010-11-18
5
Medium Priority
?
466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 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