I have two divs: div1
and div2
.
Maintaining the original css styles applied to the div2
element being printed.
I don’t want to print content inside div1
but only the inside of div2
.
How to print?
Advertisement
Answer
Try this
JavaScript
x
9
1
<style type="text/css">
2
@media print
3
{
4
body * { visibility: hidden; }
5
.div2 * { visibility: visible; }
6
.div2 { position: absolute; top: 40px; left: 30px; }
7
}
8
</style>
9