Issue
I am trying to implement a print feature in HTML. I know I can print the whole page with window.print()
, but how do I print only a specific page element? For example a particular <DIV>Some text to print</DIV>
.
Solution
You could use a print specific CSS stylesheet and hide everything but what you want printed.
<div class="no-print">I won't print</div><div class="something-else">I will!</div>
Just the no-print
class will be hidden, but anything with a print class will show.
<style type="text/css" media="print">
.no-print { display: none; }
</style>
Answered By - ashurexm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.