Created
August 2, 2017 18:08
-
-
Save sudikrt/9e7ee343738958044c1bdaefce252524 to your computer and use it in GitHub Desktop.
HTML to print section CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
@media print { | |
body * { | |
visibility: hidden; | |
} | |
#section-to-print, #section-to-print * { | |
visibility: visible; | |
} | |
} | |
</style> | |
<script> | |
function myFunction() { | |
window.print(); | |
} | |
</script> | |
</head> | |
<body> | |
<h1 id="section-to-print"> This is test Text in the worls</h1> | |
<br/> | |
<h1> This is test Text in the worls 1</h1> | |
<br/> | |
<h1 id="section-to-print"> This is test Text in the worls 2</h1> <br/> | |
<h1> This is test Text in the worls 3</h1> <br/> | |
<h1 id="section-to-print"> This is test Text in the worls 4</h1> <br/> | |
<button onclick="myFunction()">Print this page</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment