_print.scss 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. /* -----------------------/*
  2. * Feuille de style Print "Bretzel" adaptée
  3. * Made par Alsacréations + tweaks EQL
  4. /* ---------------------- */
  5. /*
  6. * Ressources et documentations :
  7. * 1- https://www.docuseal.co/blog/css-print-page-style
  8. * 2- https://www.alsacreations.com/astuce/lire/1160-Une-feuille-de-styles-de-base-pour-le-media-print.html
  9. */
  10. @import "variables/_colors";
  11. @import "variables/_typography";
  12. // Mixin commun pour les styles d'impression
  13. @mixin print-base() {
  14. /* Reset général */
  15. * {
  16. all: unset;
  17. display: revert;
  18. box-sizing: border-box;
  19. }
  20. img {
  21. max-width: 100%;
  22. }
  23. ul{
  24. list-style-type: none;
  25. }
  26. input,
  27. textarea,
  28. select {
  29. all: revert;
  30. }
  31. /* Styles globaux (12pt = 16px) */
  32. body,
  33. p,
  34. span {
  35. width: auto;
  36. margin: 0;
  37. font-family: "Marianne", serif !important;
  38. font-size: 12pt;
  39. line-height: 1.5;
  40. color: #000000 !important;
  41. background-color: #ffffff !important;
  42. }
  43. .back-cover {
  44. break-before: page;
  45. display: flex;
  46. flex-direction: column;
  47. justify-content: center;
  48. .region {
  49. h2 {
  50. margin-top: 0;
  51. color: $blue-dark;
  52. font-size: 1.2rem;
  53. }
  54. }
  55. .view-id-partenaires {
  56. .view-content {
  57. img {
  58. width: 5rem;
  59. height: auto;
  60. }
  61. a[href^="http"]:after {
  62. display: none;
  63. }
  64. }
  65. .views-row-wrapper {
  66. display: flex;
  67. flex-direction: row;
  68. flex-wrap: wrap;
  69. }
  70. }
  71. }
  72. /* Espacements typographiques (15pt = 20px) */
  73. p,
  74. blockquote,
  75. label,
  76. ul,
  77. ol {
  78. margin-block: 0 15pt;
  79. }
  80. p:last-child {
  81. margin-bottom: 0;
  82. }
  83. /* Titrages */
  84. h1 {
  85. margin-block: 0 24pt;
  86. font-weight: 700;
  87. font-size: 18pt;
  88. line-height: 1.1;
  89. }
  90. h2 {
  91. margin-block: 0 18pt;
  92. font-weight: 700;
  93. font-size: 16pt;
  94. line-height: 1.1;
  95. }
  96. h3 {
  97. margin-block: 0 15pt;
  98. font-weight: 700;
  99. font-size: 14pt;
  100. }
  101. h4 {
  102. margin-block: 0 12pt;
  103. font-weight: 700;
  104. font-size: 12pt;
  105. }
  106. /* Classes dédiées print / no-print */
  107. .print {
  108. display: revert;
  109. }
  110. .no-print {
  111. display: none;
  112. }
  113. /* Veuves / orphelines */
  114. p,
  115. blockquote {
  116. orphans: 3;
  117. widows: 3;
  118. }
  119. /* Pas de saut de page au sein de ces éléments */
  120. blockquote,
  121. ul,
  122. ol,
  123. figure,
  124. table,
  125. .paragraph,
  126. footer,
  127. .top_top,
  128. .top_bottom {
  129. page-break-inside: avoid;
  130. }
  131. /* Pas de saut de page après ces éléments */
  132. h1,
  133. h2,
  134. h3,
  135. h4,
  136. caption,
  137. .field--name-field-titre {
  138. page-break-after: avoid;
  139. }
  140. /* Pas de saut de page après ces éléments */
  141. h1{
  142. page-break-before: right;
  143. }
  144. /* Styles des liens */
  145. a,
  146. a:link,
  147. a:visited {
  148. background: transparent !important;
  149. color: unset;
  150. font-weight: 700;
  151. text-decoration: underline !important;
  152. }
  153. /* Afficher l'URL des liens externes */
  154. a[href^="http"]:after,
  155. a[href^="https"]:after {
  156. content: " (" attr(href) ")";
  157. }
  158. /* Masquer vidéos, header, nav… */
  159. video,
  160. object,
  161. iframe,
  162. nav {
  163. display: none !important;
  164. width: 0 !important;
  165. height: 0 !important;
  166. overflow: hidden !important;
  167. }
  168. /* Style page projet */
  169. .page-node-type-projet {
  170. .layout__region--top {
  171. width: 100% !important;
  172. padding-top: 0rem !important;
  173. .top_top {
  174. flex-direction: column !important;
  175. .block-entity-fieldnodefield-photo {
  176. width: 100% !important;
  177. }
  178. img{
  179. }
  180. .slick-dots,
  181. .slick-arrow {
  182. display: none !important;
  183. }
  184. .top_right {
  185. width: 100% !important;
  186. }
  187. }
  188. .top_bottom {
  189. width: 100% !important;
  190. }
  191. }
  192. .layout__region--first {
  193. display: none;
  194. }
  195. .layout__region--second {
  196. flex: 0 0 100% !important;
  197. margin-left: 10%;
  198. margin-right: 10%;
  199. width: 100% !important;
  200. }
  201. }
  202. }
  203. /* 1) VRAIE feuille d'impression */
  204. @media print {
  205. /* Dimension et marges de page */
  206. @page {
  207. size: A4 portrait;
  208. margin: 1.5cm 1.5cm;
  209. @bottom-center {
  210. content: "Page " counter(page) " / " counter(pages);
  211. }
  212. }
  213. @include print-base();
  214. /* 1) Le header du site ne s’imprime jamais */
  215. .layout-container header[role="banner"] {
  216. display: none !important;
  217. }
  218. /* 2) Couverture (print only) */
  219. .cover.print-only {
  220. display: flex !important;
  221. flex-direction: column;
  222. justify-content: center;
  223. align-items: center;
  224. min-height: 100vh;
  225. padding: 2cm 1.5cm;
  226. text-align: center;
  227. page-break-after: always;
  228. break-after: page;
  229. background: #fff !important;
  230. color: #000 !important;
  231. }
  232. /* Reprend tes règles “logo + titre” mais sur la cover */
  233. .cover.print-only .region-header-top-left img {
  234. max-height: 3cm;
  235. height: auto;
  236. width: auto;
  237. }
  238. .cover.print-only .region-header-top-rigth #block-eql-identitedusite {
  239. font-size: 1.4rem;
  240. text-transform: uppercase;
  241. }
  242. /* Optionnel : pas d’URL affichée sur la cover */
  243. .cover.print-only a[href^="http"]:after {
  244. display: none;
  245. }
  246. }
  247. /* 2) MODE DEBUG : voir la version print en écran via body.debug-print */
  248. @media screen {
  249. body.debug-print {
  250. @include print-base();
  251. }
  252. .cover.print-only {
  253. display: none;
  254. }
  255. body.debug-print .print-page {
  256. width: 210mm;
  257. height: 297mm;
  258. margin: 2rem auto;
  259. background: #fff;
  260. box-shadow: 0 0 0 1px red; // limite page
  261. }
  262. /* cacher les éléments print-only à l'écran */
  263. .print-only { display: none; }
  264. }