Lab 09: Print & Email CSS
Overview
Step 1: Print Media Query
/* Separate print stylesheet */
<link rel="stylesheet" href="print.css" media="print">
/* Or inline in main stylesheet */
@media print {
/* ALL print styles here */
}
/* Avoid: avoid loading print stylesheet for screen */
/* Use: @media print {} for co-location *//* Essential print resets */
@media print {
/* Remove backgrounds (save ink) */
*, *::before, *::after {
background: transparent !important;
color: #000 !important;
box-shadow: none !important;
text-shadow: none !important;
}
/* Remove interactive elements */
nav, aside, .sidebar, .no-print,
header .nav, footer .social-links,
.cookie-banner, .chat-widget,
video, audio, iframe {
display: none !important;
}
/* Ensure links are readable */
a, a:visited { text-decoration: underline; }
a[href]::after { content: " (" attr(href) ")"; }
abbr[title]::after { content: " (" attr(title) ")"; }
/* Don't show hash/javascript links */
a[href^="#"]::after,
a[href^="javascript:"]::after { content: ""; }
/* Show images */
img { max-width: 100% !important; }
/* Page break rules */
thead { display: table-header-group; } /* repeat table header on each page */
tr, img { page-break-inside: avoid; }
/* Typography */
body {
font-size: 12pt;
line-height: 1.5;
font-family: Georgia, serif;
}
}Step 2: @page Rule
Step 3: Page Breaks, Orphans, Widows
Step 4: HTML Email Fundamentals
Step 5: Email Client Quirks
Step 6: Responsive Email
Step 7: MJML Framework
Step 8: Capstone — Print CSS Generator
Summary
Feature
CSS
Support
Last updated
