• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

Pop Up Window with Contents of Div

I'd like to know the best way to be able to click a button called print that will pop up a new window with the contents of a div on the current page to be printed.
Nathan Riley
Nathan Riley
  • 2
1 Solution
You don't really need a new window.  Just use an @media print in the stylesheet

@media print
     style rules here

Then set everything you don't want to print to display:none, and apply any special style you need to the div for optimum printing.

for the button you just need onclick="window.print();"

Nathan RileyFounderAuthor Commented:
For this solution I need to have it open in a new window.
Nathan RileyFounderAuthor Commented:
Nevermind, I see what you mean now, it opens it into a print view anyways almost like a popup window.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now