?
Solved

hide html table when printing

Posted on 2010-11-18
5
Medium Priority
?
471 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
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…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

649 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