Solved

Have section of code not render with use of css

Posted on 2013-12-17
4
226 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

777 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