css print

This commit is contained in:
2025-12-16 12:13:43 +01:00
parent d05acf87b3
commit 1c8c8aa73f
12 changed files with 33460 additions and 726 deletions
+83 -283
View File
@@ -1,310 +1,110 @@
/* -----------------------/*
* Feuille de style Print "Bretzel" adaptée
* Made par Alsacréations + tweaks EQL
/* ---------------------- */
/* -------------------------
Paged.js : format + compteur
-------------------------- */
@page {
size: A4 portrait;
margin: 1.5cm;
/*
* Ressources et documentations :
* 1- https://www.docuseal.co/blog/css-print-page-style
* 2- https://www.alsacreations.com/astuce/lire/1160-Une-feuille-de-styles-de-base-pour-le-media-print.html
*/
@import "variables/_colors";
@import "variables/_typography";
// Mixin commun pour les styles d'impression
@mixin print-base() {
/* Reset général */
* {
all: unset;
display: revert;
box-sizing: border-box;
}
img {
max-width: 100%;
}
ul{
list-style-type: none;
}
input,
textarea,
select {
all: revert;
}
/* Styles globaux (12pt = 16px) */
body,
p,
span {
width: auto;
margin: 0;
font-family: "Marianne", serif !important;
font-size: 12pt;
line-height: 1.5;
color: #000000 !important;
background-color: #ffffff !important;
}
.back-cover {
break-before: page;
display: flex;
flex-direction: column;
justify-content: center;
.region {
h2 {
margin-top: 0;
color: $blue-dark;
font-size: 1.2rem;
}
}
.view-id-partenaires {
.view-content {
img {
width: 5rem;
height: auto;
}
a[href^="http"]:after {
display: none;
}
}
.views-row-wrapper {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
}
}
/* Espacements typographiques (15pt = 20px) */
p,
blockquote,
label,
ul,
ol {
margin-block: 0 15pt;
}
p:last-child {
margin-bottom: 0;
}
/* Titrages */
h1 {
margin-block: 0 24pt;
font-weight: 700;
font-size: 18pt;
line-height: 1.1;
}
h2 {
margin-block: 0 18pt;
font-weight: 700;
font-size: 16pt;
line-height: 1.1;
}
h3 {
margin-block: 0 15pt;
font-weight: 700;
font-size: 14pt;
}
h4 {
margin-block: 0 12pt;
font-weight: 700;
font-size: 12pt;
}
/* Classes dédiées print / no-print */
.print {
display: revert;
}
.no-print {
display: none;
}
/* Veuves / orphelines */
p,
blockquote {
orphans: 3;
widows: 3;
}
/* Pas de saut de page au sein de ces éléments */
blockquote,
ul,
ol,
figure,
table,
.paragraph,
footer,
.top_top,
.top_bottom {
page-break-inside: avoid;
}
/* Pas de saut de page après ces éléments */
h1,
h2,
h3,
h4,
caption,
.field--name-field-titre {
page-break-after: avoid;
}
/* Pas de saut de page après ces éléments */
h1{
page-break-before: right;
}
/* Styles des liens */
a,
a:link,
a:visited {
background: transparent !important;
color: unset;
font-weight: 700;
text-decoration: underline !important;
}
/* Afficher l'URL des liens externes */
a[href^="http"]:after,
a[href^="https"]:after {
content: " (" attr(href) ")";
}
/* Masquer vidéos, header, nav… */
video,
object,
iframe,
nav {
display: none !important;
width: 0 !important;
height: 0 !important;
overflow: hidden !important;
}
/* Style page projet */
.page-node-type-projet {
.layout__region--top {
width: 100% !important;
padding-top: 0rem !important;
.top_top {
flex-direction: column !important;
.block-entity-fieldnodefield-photo {
width: 100% !important;
}
img{
}
.slick-dots,
.slick-arrow {
display: none !important;
}
.top_right {
width: 100% !important;
}
}
.top_bottom {
width: 100% !important;
}
}
.layout__region--first {
display: none;
}
.layout__region--second {
flex: 0 0 100% !important;
margin-left: 10%;
margin-right: 10%;
width: 100% !important;
}
@bottom-center {
content: "Page " counter(page) " / " counter(pages);
font-size: 9pt;
}
}
/* 1) VRAIE feuille d'impression */
/* Pas de numéro sur cover / back-cover */
.cover { page: cover; }
.back-cover { page: backcover; }
@page cover { @bottom-center { content: none; } }
@page backcover { @bottom-center { content: none; } }
/* -------------------------
PRINT (Ctrl+P)
-------------------------- */
@media print {
/* Dimension et marges de page */
@page {
size: A4 portrait;
margin: 1.5cm 1.5cm;
@bottom-center {
content: "Page " counter(page) " / " counter(pages);
}
}
@include print-base();
/* 1) Le header du site ne simprime jamais */
.layout-container header[role="banner"] {
/* Cache lUI du site */
header[role="banner"],
footer[role="contentinfo"],
nav,
.slick-arrow,
.slick-dots,
.layout__region--first{
display: none !important;
}
.layout__region--top{
flex: 0 1 100% !important;
.block-entity-fieldnodefield-photo,
.top_right{
width: 100% !important;
}
}
.top_top{
flex-direction: column !important;
}
.layout__region--second{
flex: 0 1 100% !important;
margin: auto;
margin-left: 3rem;
}
/* 2) Couverture (print only) */
/* Cover */
.cover.print-only {
display: flex !important;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 2cm 1.5cm;
align-items: center;
justify-content: center;
text-align: center;
page-break-after: always;
break-after: page;
background: #fff !important;
color: #000 !important;
}
/* Reprend tes règles “logo + titre” mais sur la cover */
.cover.print-only .region-header-top-left img {
max-height: 3cm;
height: auto;
width: auto;
/* Back cover */
.back-cover.print-only {
break-before: page;
.views-row-wrapper{
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
}
.cover.print-only .region-header-top-rigth #block-eql-identitedusite {
font-size: 1.4rem;
text-transform: uppercase;
/* Optionnel : éviter lURL après liens sur la cover */
.cover.print-only a[href^="http"]::after,
.cover.print-only a[href^="https"]::after {
content: "" !important;
}
/* Optionnel : pas dURL affichée sur la cover */
.cover.print-only a[href^="http"]:after {
display: none;
}
}
/* 2) MODE DEBUG : voir la version print en écran via body.debug-print */
/* -------------------------
SCREEN preview (Paged.js)
-------------------------- */
@media screen {
body.debug-print {
@include print-base();
/* En écran normal : cacher print-only */
body:not(.use-paged) .print-only { display: none !important; }
/* Fond et affichage pages */
body.use-paged { background: #ddd; }
body.use-paged .pagedjs_pages {
width: 100%;
padding: 2rem 0;
}
.cover.print-only {
display: none;
}
body.debug-print .print-page {
width: 210mm;
height: 297mm;
margin: 2rem auto;
body.use-paged .pagedjs_page {
margin: 1rem auto;
background: #fff;
box-shadow: 0 0 0 1px red; // limite page
box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
body.use-paged .pagedjs_pagebox {
width: 210mm;
min-height: 297mm;
margin: 0 auto;
background: #fff;
}
/* Paged.js met le contenu dans .pagedjs_page_content : on évite les surprises */
body.use-paged .pagedjs_page_content {
display: block;
}
/* cacher les éléments print-only à l'écran */
.print-only { display: none; }
}