?
Solved

Have section of code not render with use of css

Posted on 2013-12-17
4
Medium Priority
?
232 Views
Last Modified: 2014-01-21
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!!
0
Comment
Question by:armanbena
[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
4 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 39725280
You can't 'hide' a </table> because it doesn't display in the first place.  And if you manage to leave it out or put it in a comment, then everything after the table is likely to display funny on the page because you have broken the formatting.  You need to re-think what you want and how to do it.
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39725407
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

0

Featured Post

Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
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…

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