Solved

Have section of code not render with use of css

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

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now