/ Published in: CSS
defining a printable area from a html web page. Making only one place printable
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<html> <head> <style type="text/css"> @media print { body * { visibility:hidden; } #printable, #printable * { visibility:visible; } #printable { /* aligning the printable area */ position:absolute; left:40; top:40; } } </style> </head> <body> <div id="printable"> printable area <br> printable area <br> printable area </div> <div> Curabitur tempus hendrerit semper. Nulla vel felis est. Cras nec mattis mauris. Vestibulum volutpat urna viverra mi viverra non ultrices leo semper. Maecenas scelerisque, augue quis scelerisque aliquam, magna velit scelerisque urna, in aliquet lectus dolor vitae urna. Nullam faucibus mattis hendrerit. Nam tortor elit, vulputate quis viverra vitae, dapibus id magna. Ut ultricies rhoncus erat, id pharetra dui tincidunt at. In lorem lorem, suscipit nec elementum vitae, venenatis id ligula. Suspendisse et erat id neque facilisis ultricies ac in neque. Vestibulum suscipit risus sed erat varius molestie. </div> </body> </html>