Solved

hide html table when printing

Posted on 2010-11-18
5
460 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 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
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 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.

749 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