Solved

Have section of code not render with use of css

Posted on 2013-12-17
4
228 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
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 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 52

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

821 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