Link to home
Start Free TrialLog in
Avatar of armanbena
armanbena

asked on

Have section of code not render with use of css

Hi,

I have some code that want to have not be rendered (or space held) in html. But if a person should choose to print a pdf of the file, it will produce.

I tried this using a css.

#showit {visibility: visible;}

#hideit {display:block;}

What I'm trying to get to be ignored is a closing table tag. I want the table to be continuous in the html. If it should print then I am closing the table so it doesn't run off the page.

I tried display:none as well. That did not work. Is there something I can use that can set it to ignore completely unless I print?

Thanks!!
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could try to use a media query for print and make the table a maximum hight.  It would just cut off though.  What would you do with the rest of the data?  If print is important, I would set up the page for print where I am counting the number of rows in my code and at x lines force a page break.

@media screen
  {
 table { ..your css.. }
  }
@media print
  {
  table {max-height:3in;overflow:hidden}
  }

Open in new window