Last active
August 29, 2015 14:08
-
-
Save 7studio/da671149d2209a4a43ac to your computer and use it in GitHub Desktop.
Universal CSS for web printing
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
/* | |
* | |
* Styles communs pour la mise en page à l'impression | |
* === | |
* | |
* … | |
* | |
* ## Ressources | |
* | |
* - http://www.w3.org/TR/css-print/ | |
* - http://www.pompage.net/traduction/impression | |
* - https://github.com/vladocar/Hartija---CSS-Print-Framework | |
* - https://github.com/raphaelgoetter/KNACSS/blob/master/sass/_09-print.scss | |
*/ | |
body { | |
color: #000; | |
font-size: 14pt; | |
line-height: normal; | |
font-family: serif; | |
background-color: #fff; | |
} | |
a { | |
color: #00f; | |
text-decoration: underline; | |
} | |
/* | |
* 1. Assure la présence d'au moins 3 lignes de contenu en bas des pages en | |
* cas de coupure au sein des paragraphes, ceci afin d'éviter | |
* les lignes orphelines. | |
* 2. Spécifie le nombre minimal de lignes de contenu d'un même paragraphe | |
* à afficher ensemble en haut des pages, ceci afin d'éviter | |
* les lignes veuves. | |
*/ | |
p { | |
orphans: 3; /* 1 */ | |
widows: 3; /* 2 */ | |
} | |
/* | |
* 1. Évite les sauts de page à l'intérieur de l'élément HTML. | |
*/ | |
blockquote, | |
ul, | |
ol, | |
dl { | |
page-break-inside: avoid; /* 1 */ | |
} | |
/* | |
* 1. Empêche les sauts de page à l'intérieur et après l'élément HTML. | |
*/ | |
h1, | |
h2, | |
h3, | |
caption { | |
page-break-inside: avoid; /* 1 */ | |
page-break-after: avoid; /* 1 */ | |
} | |
abbr[title]::after { | |
content: "\0A0(" attr(title) ") "; | |
font-size: smaller; | |
} |
Souligner les liens a-t-il un intérêt à l'impression ?
Ex. : http://www.lefigaro.fr/conjoncture/2015/03/30/20002-20150330ARTFIG00074-emploi-impots8230-apres-la-claque-electorale-valls-annonce-deja-des-reformes.php?print=true
/*
* 1. Autorise la césure à l'intérieur de la chaîne qui sera affichée
* pour éviter son dépassement de la boîte de page.
*/
a::after {
font-size: smaller;
word-wrap: break-word; /* 1 */
}
a[href^="/"]::after {
content: "\0A0(http://www.7studio.fr" attr(href) ") ";
}
a[href^="http"]::after,
a[href^="//"]::after {
content: "\0A0(" attr(href) ") ";
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Voici une bonne raison de ne pas inclure la partie "liens" par défaut : http://www.visitscotland.com/blog/edinburgh-lothians/edinburgh-hidden-gems/