Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Printing a div

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #34451
    chanman
    Member

    This is Probably a dumb question but is there some easy way to make a div a link or something to when you click the link it prints.

    #87711
    chrisburton
    Participant

    To clarify: You mean so when you click a link/button your printing options pop up?

    #87722
    chanman
    Member

    What I am actually wanting is a div with only text in it, to pull up the printing options when you click on it anywhere. But I only want it to print what is inside the div and nothing else on the page. Sorta like printing text on a page but only certain text. It’s kinda confusing let me know if you don’t understand.

    #87723
    chanman
    Member

    I didn’t want to have to make a print stylesheet but there may be no other way for what i’m wanting.

    #87742
    chrisburton
    Participant

    Yeah, I’ve never heard anything being done like this.

    #87746
    chanman
    Member

    I didn’t think I was going to be able to do it. I wish there was some kind of plugin for it.

    #87751
    Mottie
    Member

    I’ve done something like this before… the problem is the browser, by default, will print the entire page. So the trick is to open up a new window with the content you want printed, then have the browser print the contents of that window.

    I put together an example for you… it has a few variables you can modify such as “autoPrint” which when true will automatically start printing, well the print option window should pop up. Otherwise you need to click the print button inside the popup window. Then manually close the popup – I don’t think there is any way around that.

    I hope that helps!

    #87754
    chanman
    Member

    That is exactly what I’m looking for thanks everyone.

    #128472

    How Can i load CSS If i use CTRL+P in Google Chrome.

    I can maintain the print command from button click events like that. But when i use CTRL + P in google Chrome …it does not inherit the CSS.

    #128863
    Mottie
    Member

    Hi vebbymastidude!

    You should just include the print styling in your main css. Use a link with media=”print” or use an inline `@media print`. Check out [this guide](http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml).

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘CSS’ is closed to new topics and replies.