www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Print Page but only a certain div?

  1. #1
    Join Date
    Apr 2011
    Location
    New Home Team - Everett, WA
    Posts
    261

    resolved [RESOLVED] Print Page but only a certain div?

    I have a javascript "print page" button on a webpage... is it possible to print only a certain div? Or would I have to just copy that div onto an "empty" page for printing?

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,105
    You can control this easily in a print stylesheet.

    Ex:

    Code:
    <link rel="stylesheet" type="text/css" media="print" href="print.css" />
    <p>blah blah blah</p>
    <p>blah blah blah</p>
    <p>blah blah blah</p>
    <p>blah blah blah</p>
    <p class="print-this">print me</p>
    <p>blah blah blah</p>
    <p>blah blah blah</p>
    The print.css would look like this:

    Code:
    p {display: none;}
    p.print-this {display: block;}
    I'm always up for networking with fellow web professionals. Connect with me on LinkedIn if you like!

  3. #3
    Join Date
    Apr 2011
    Location
    New Home Team - Everett, WA
    Posts
    261
    Thanks, that should help. I just have to work-in a before-and-after container for the stuff I want to be ignored.

    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles