Skip to content

Instantly share code, notes, and snippets.

@Ronnasayd
Created October 13, 2020 14:45
Show Gist options
  • Save Ronnasayd/423b60456da2cba809da47017aead9c0 to your computer and use it in GitHub Desktop.
Save Ronnasayd/423b60456da2cba809da47017aead9c0 to your computer and use it in GitHub Desktop.
styles to standard pdf formatting
/**
* Print Stylesheet fuer Deinewebsite.de
* @version 1.0
* @lastmodified 16.06.2016
*/
@media print {
/* Inhaltsbreite setzen, Floats und Margins aufheben */
/* Achtung: Die Klassen und IDs variieren von Theme zu Theme. Hier also eigene Klassen setzen */
#content, #page {
width: 100% !important;
margin: 0 !important;
float: none !important;
}
/** Seitenränder einstellen */
@page {
margin: 1cm;
size: A4;
// orientation: landscape;
}
/* Font auf 16px/13pt setzen, Background auf Weiß und Schrift auf Schwarz setzen.*/
/* Das spart Tinte */
body {
font: 13pt Georgia, "Times New Roman", Times, serif !important;
line-height: 1.3 !important;
background: #fff !important !important;
color: #000 !important;
}
h1 {
color: #000 !important;
font-size: 24pt !important;
}
h2, h3, h4 ,h5, h6 {
color: #000 !important;
font-size: 14pt !important;
margin-top: 25px !important;
}
/* Alle Seitenumbrüche definieren */
a {
page-break-inside:avoid !important;
}
blockquote {
page-break-inside: avoid !important;
}
h1, h2, h3, h4, h5, h6 {
page-break-after:avoid !important;
page-break-inside:avoid !important;
}
img {
page-break-inside:avoid !important;
page-break-after:avoid !important;
}
table, pre { page-break-inside:avoid !important; }
ul, ol, dl { page-break-before:avoid !important;}
/* Linkfarbe und Linkverhalten darstellen */
a:link, a:visited, a {
background: transparent !important;
color: #520 !important;
font-weight: bold !important;
text-decoration: underline !important;
text-align: left !important;
}
a {
page-break-inside:avoid !important;
}
a[href^=http]:after {
content:" <" attr(href) "> ";
}
a:after > img {
content: "";
}
article a[href^="#"]:after {
content: "";
}
a:not(:local-link):after {
content:" <" attr(href) "> ";
}
/**
* Eingebundene Videos verschwinden lassen und den Whitespace der iframes auf null reduzieren.
*/
iframe, ins {
display: none !important;
width: 0 !important;
height: 0 !important;
overflow: hidden !important;
line-height: 0pt !important;
white-space: nowrap !important;
}
/* Unnötige Elemente ausblenden für den Druck */
nav, aside ,footer, img {
display: none !important;
}
/* Wichtige Elemente definieren */
p, address, li, dt, dd, blockquote {
color: #000 !important;
font-size: 100% !important;
}
span {
color: #000 !important;
}
/* Zeichensatz fuer Code Beispiele */
code, pre { font-family: "Courier New", Courier, mono}
ul, ol {
list-style: square; margin-left: 18pt !important;
margin-bottom: 20pt !important;
}
li {
line-height: 1.6em !important;
}
.print {
display: block !important; // quando o que eu quero imprimir está oculto
}
.no-print {
display: none !important; //quando o que eu não quero imprimir esta visivel
}
.page-break{
page-break-before: always !important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment