Last active
April 8, 2024 08:47
-
-
Save vielhuber/98006c7c8c82eb88cca58780a0683330 to your computer and use it in GitHub Desktop.
print.css: page breaks and margin #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
<!DOCTYPE html> | |
<html lang="de"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" /> | |
<title>.</title> | |
<link rel="stylesheet" type="text/css" media="print" href="print.css" /> | |
</head> | |
<body> | |
<div id="content"> | |
Content on page 1 | |
<div class="page-break"></div> | |
Content on page 2 | |
<div class="page-break"></div> | |
Content on page 3 | |
<div class="avoid-break"> | |
This div is never split up. | |
</div> | |
</div> | |
</body> | |
</html> |
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, body { | |
padding:0; | |
margin:0; | |
} | |
.page-break { | |
page-break-before: always; | |
} | |
.avoid-break { | |
page-break-inside: avoid; | |
} | |
--> | |
</style> | |
</head> | |
<body> | |
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
@page { | |
size: A4 portrait; | |
margin: 2cm 3cm; | |
} | |
html, body { | |
padding:0; | |
margin:0; | |
} | |
body { | |
background-color:red; | |
} | |
.page-break { | |
page-break-before: always; | |
} | |
.avoid-break { | |
page-break-inside: avoid; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment